From 39997732c36c7f58b31df688b14900892fa23003 Mon Sep 17 00:00:00 2001 From: braks <78412429+bcakmakoglu@users.noreply.github.com> Date: Mon, 5 Dec 2022 17:44:23 +0100 Subject: [PATCH] fix(additional-components): render minimap node slot Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com> --- .../src/minimap/MiniMapNode.ts | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/packages/additional-components/src/minimap/MiniMapNode.ts b/packages/additional-components/src/minimap/MiniMapNode.ts index 098e5f1c..cf60cc17 100644 --- a/packages/additional-components/src/minimap/MiniMapNode.ts +++ b/packages/additional-components/src/minimap/MiniMapNode.ts @@ -7,11 +7,15 @@ export default defineComponent({ props: ['id', 'position', 'dimensions', 'strokeWidth', 'strokeColor', 'borderRadius', 'color', 'shapeRendering', 'type'], emits: ['click', 'dblclick', 'mouseenter', 'mousemove', 'mouseleave'], setup(props: MiniMapNodeProps, { attrs, emit }) { - const style = (attrs.style ?? {}) as CSSProperties const miniMapSlots: Slots = inject(MiniMapSlots)! - return () => [ - h('rect', { + return () => { + const style = (attrs.style ?? {}) as CSSProperties + const slot = miniMapSlots[`node-${props.type}`] + + if (slot) return slot!(props) + + return h('rect', { id: props.id, class: ['vue-flow__minimap-node', attrs.class].join(' '), style, @@ -30,8 +34,7 @@ export default defineComponent({ onMouseenter: (e: MouseEvent) => emit('mouseenter', e), onMousemove: (e: MouseEvent) => emit('mousemove', e), onMouseleave: (e: MouseEvent) => emit('mouseleave', e), - }), - miniMapSlots[props.type] && miniMapSlots[props.type]!(props), - ] + }) + } }, })