feat: Add width and height options to minimap

This commit is contained in:
Braks
2022-05-27 23:36:01 +02:00
parent a6e6f31e9c
commit 0cd6eaff35
2 changed files with 7 additions and 2 deletions
@@ -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
@@ -75,6 +75,9 @@ export interface MiniMapProps<Data = ElementData> {
nodeStrokeWidth?: number
/** Background color of minimap */
maskColor?: string
width?: number
height?: number
}
/** these props are passed to mini map node slots */