From 0cd6eaff359793a02c1b783bd8f84c2351e54f32 Mon Sep 17 00:00:00 2001 From: Braks <78412429+bcakmakoglu@users.noreply.github.com> Date: Sun, 24 Apr 2022 14:55:40 +0200 Subject: [PATCH] feat: Add width and height options to minimap --- .../vue-flow/src/additional-components/MiniMap/MiniMap.vue | 6 ++++-- packages/vue-flow/src/types/components.ts | 3 +++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/vue-flow/src/additional-components/MiniMap/MiniMap.vue b/packages/vue-flow/src/additional-components/MiniMap/MiniMap.vue index d08816e6..816ca9f0 100644 --- a/packages/vue-flow/src/additional-components/MiniMap/MiniMap.vue +++ b/packages/vue-flow/src/additional-components/MiniMap/MiniMap.vue @@ -6,6 +6,8 @@ import type { MiniMapProps } from '../../types/components' import MiniMapNode from './MiniMapNode' const { + width, + height, nodeStrokeColor = '#555', nodeColor = '#fff', nodeClassName, @@ -23,9 +25,9 @@ const defaultHeight = 150 const { edges, viewport, dimensions, hooks, getNodes } = $(useVueFlow()) -const elementWidth = attrs.style?.width ?? defaultWidth +const elementWidth = $computed(() => width ?? attrs.style?.width ?? defaultWidth) -const elementHeight = attrs.style?.height ?? defaultHeight +const elementHeight = $computed(() => height ?? attrs.style?.height ?? defaultHeight) const nodeColorFunc: MiniMapNodeFunc = nodeColor instanceof Function ? nodeColor : () => nodeColor as string diff --git a/packages/vue-flow/src/types/components.ts b/packages/vue-flow/src/types/components.ts index 807b9a42..c67882a8 100644 --- a/packages/vue-flow/src/types/components.ts +++ b/packages/vue-flow/src/types/components.ts @@ -75,6 +75,9 @@ export interface MiniMapProps { nodeStrokeWidth?: number /** Background color of minimap */ maskColor?: string + + width?: number + height?: number } /** these props are passed to mini map node slots */