feat: Add width and height options to minimap
This commit is contained in:
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user