Skip to content

Commit 0a0d8af

Browse files
committed
fix(minimap): hide minimap node if graph node is hidden (#1739)
* fix(minimap): hide minimap node if graph node is hidden Signed-off-by: braks <[email protected]> * chore(changeset): add Signed-off-by: braks <[email protected]> --------- Signed-off-by: braks <[email protected]>
1 parent 6f3ed67 commit 0a0d8af

File tree

4 files changed

+31
-22
lines changed

4 files changed

+31
-22
lines changed

.changeset/three-phones-grow.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@vue-flow/minimap": patch
3+
---
4+
5+
Hide minimap node when graph node is hidden.

packages/minimap/src/MiniMap.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,7 @@ export default {
244244
:stroke-width="nodeStrokeWidth"
245245
:shape-rendering="shapeRendering"
246246
:type="node.type"
247+
:hidden="node.hidden"
247248
@click="onNodeClick($event, node)"
248249
@dblclick="onNodeDblClick($event, node)"
249250
@mouseenter="onNodeMouseEnter($event, node)"

packages/minimap/src/MiniMapNode.vue

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -43,27 +43,29 @@ export default {
4343
</script>
4444

4545
<template>
46-
<component :is="miniMapSlots[`node-${props.type}`]" v-if="miniMapSlots[`node-${props.type}`]" v-bind="props" />
46+
<template v-if="!hidden && dimensions.width !== 0 && dimensions.height !== 0">
47+
<component :is="miniMapSlots[`node-${props.type}`]" v-if="miniMapSlots[`node-${props.type}`]" v-bind="props" />
4748

48-
<rect
49-
v-else
50-
:id="id"
51-
class="vue-flow__minimap-node"
52-
:class="{ selected, dragging }"
53-
:x="position.x"
54-
:y="position.y"
55-
:rx="borderRadius"
56-
:ry="borderRadius"
57-
:width="dimensions.width"
58-
:height="dimensions.height"
59-
:fill="color || (style.background as string) || style.backgroundColor"
60-
:stroke="strokeColor"
61-
:stroke-width="strokeWidth"
62-
:shape-rendering="shapeRendering"
63-
@click="onClick"
64-
@dblclick="onDblclick"
65-
@mouseenter="onMouseEnter"
66-
@mousemove="onMouseMove"
67-
@mouseleave="onMouseLeave"
68-
/>
49+
<rect
50+
v-else
51+
:id="id"
52+
class="vue-flow__minimap-node"
53+
:class="{ selected, dragging }"
54+
:x="position.x"
55+
:y="position.y"
56+
:rx="borderRadius"
57+
:ry="borderRadius"
58+
:width="dimensions.width"
59+
:height="dimensions.height"
60+
:fill="color || (style.background as string) || style.backgroundColor"
61+
:stroke="strokeColor"
62+
:stroke-width="strokeWidth"
63+
:shape-rendering="shapeRendering"
64+
@click="onClick"
65+
@dblclick="onDblclick"
66+
@mouseenter="onMouseEnter"
67+
@mousemove="onMouseMove"
68+
@mouseleave="onMouseLeave"
69+
/>
70+
</template>
6971
</template>

packages/minimap/src/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ export interface MiniMapNodeProps {
5858
shapeRendering?: ShapeRendering
5959
strokeColor?: string
6060
strokeWidth?: number
61+
hidden?: boolean
6162
}
6263

6364
export interface MiniMapEmits {

0 commit comments

Comments
 (0)