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'
|
import MiniMapNode from './MiniMapNode'
|
||||||
|
|
||||||
const {
|
const {
|
||||||
|
width,
|
||||||
|
height,
|
||||||
nodeStrokeColor = '#555',
|
nodeStrokeColor = '#555',
|
||||||
nodeColor = '#fff',
|
nodeColor = '#fff',
|
||||||
nodeClassName,
|
nodeClassName,
|
||||||
@@ -23,9 +25,9 @@ const defaultHeight = 150
|
|||||||
|
|
||||||
const { edges, viewport, dimensions, hooks, getNodes } = $(useVueFlow())
|
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
|
const nodeColorFunc: MiniMapNodeFunc = nodeColor instanceof Function ? nodeColor : () => nodeColor as string
|
||||||
|
|
||||||
|
|||||||
@@ -75,6 +75,9 @@ export interface MiniMapProps<Data = ElementData> {
|
|||||||
nodeStrokeWidth?: number
|
nodeStrokeWidth?: number
|
||||||
/** Background color of minimap */
|
/** Background color of minimap */
|
||||||
maskColor?: string
|
maskColor?: string
|
||||||
|
|
||||||
|
width?: number
|
||||||
|
height?: number
|
||||||
}
|
}
|
||||||
|
|
||||||
/** these props are passed to mini map node slots */
|
/** these props are passed to mini map node slots */
|
||||||
|
|||||||
Reference in New Issue
Block a user