update: mini map to accept node slot instead of "nodes" slot
* some type updates Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
@@ -6,7 +6,7 @@ export interface ControlButtonProps extends ButtonHTMLAttributes {}
|
|||||||
const props: any = defineProps<ControlButtonProps>()
|
const props: any = defineProps<ControlButtonProps>()
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<button :class="['vue-flow__controls-button']" v-bind="props">
|
<button class="vue-flow__controls-button" v-bind="props">
|
||||||
<slot></slot>
|
<slot></slot>
|
||||||
</button>
|
</button>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -90,8 +90,20 @@ const d = computed(() => {
|
|||||||
:viewBox="`${viewBox.x || 0} ${viewBox.y || 0} ${viewBox.width || 0} ${viewBox.height || 0}`"
|
:viewBox="`${viewBox.x || 0} ${viewBox.y || 0} ${viewBox.width || 0} ${viewBox.height || 0}`"
|
||||||
class="vue-flow__minimap"
|
class="vue-flow__minimap"
|
||||||
>
|
>
|
||||||
<slot name="mini-map-nodes" :nodes="nodes" :view-box="viewBox">
|
<template v-for="node of nodes" :key="`mini-map-node-${node.id}`">
|
||||||
<template v-for="(node, i) of nodes" :key="`mini-map-node-${i}`">
|
<slot
|
||||||
|
:x="node.__rf.position.x"
|
||||||
|
:y="node.__rf.position.y"
|
||||||
|
:width="node.__rf.width"
|
||||||
|
:height="node.__rf.height"
|
||||||
|
:style="node.style"
|
||||||
|
:class="nodeClassNameFunc(node)"
|
||||||
|
:color="nodeColorFunc(node)"
|
||||||
|
:border-radius="props.nodeBorderRadius"
|
||||||
|
:stroke-color="nodeStrokeColorFunc(node)"
|
||||||
|
:stroke-width="props.nodeStrokeWidth"
|
||||||
|
:shape-rendering="shapeRendering"
|
||||||
|
>
|
||||||
<MiniMapNode
|
<MiniMapNode
|
||||||
:x="node.__rf.position.x"
|
:x="node.__rf.position.x"
|
||||||
:y="node.__rf.position.y"
|
:y="node.__rf.position.y"
|
||||||
@@ -105,8 +117,8 @@ const d = computed(() => {
|
|||||||
:stroke-width="props.nodeStrokeWidth"
|
:stroke-width="props.nodeStrokeWidth"
|
||||||
:shape-rendering="shapeRendering"
|
:shape-rendering="shapeRendering"
|
||||||
/>
|
/>
|
||||||
</template>
|
</slot>
|
||||||
</slot>
|
</template>
|
||||||
<path class="vue-flow__minimap-mask" :d="d" :fill="props.maskColor" fill-rule="evenodd" />
|
<path class="vue-flow__minimap-mask" :d="d" :fill="props.maskColor" fill-rule="evenodd" />
|
||||||
</svg>
|
</svg>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ interface MiniMapNodeProps {
|
|||||||
height?: number
|
height?: number
|
||||||
borderRadius?: number
|
borderRadius?: number
|
||||||
color?: string
|
color?: string
|
||||||
shapeRendering?: 'auto' | 'optimizeSpeed' | 'crispEdges' | 'geometricPrecision' | 'inherit'
|
shapeRendering?: CSSProperties['shapeRendering']
|
||||||
strokeColor?: string
|
strokeColor?: string
|
||||||
strokeWidth?: number
|
strokeWidth?: number
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user