diff --git a/packages/svelte/src/lib/plugins/Minimap/Minimap.svelte b/packages/svelte/src/lib/plugins/Minimap/Minimap.svelte index 20b2317d..2e6a7364 100644 --- a/packages/svelte/src/lib/plugins/Minimap/Minimap.svelte +++ b/packages/svelte/src/lib/plugins/Minimap/Minimap.svelte @@ -9,10 +9,11 @@ import cc from 'classcat'; import { getBoundsOfRects, + getInternalNodesBounds, getNodeDimensions, getNodePositionWithOrigin, - getNodesBounds, - nodeHasDimensions + nodeHasDimensions, + type Rect } from '@xyflow/system'; import { useStore } from '$lib/store'; @@ -49,6 +50,7 @@ const defaultHeight = 150; const { nodes, + nodeLookup, viewport, width: containerWidth, height: containerHeight, @@ -71,7 +73,14 @@ width: $containerWidth / $viewport.zoom, height: $containerHeight / $viewport.zoom }; - $: boundingRect = $nodes.length > 0 ? getBoundsOfRects(getNodesBounds($nodes), viewBB) : viewBB; + let boundingRect: Rect = viewBB; + + $: { + boundingRect = + $nodeLookup.size > 0 ? getBoundsOfRects(getInternalNodesBounds($nodeLookup), viewBB) : viewBB; + $nodes; + } + $: elementWidth = width ?? defaultWidth; $: elementHeight = height ?? defaultHeight; $: scaledWidth = boundingRect.width / elementWidth; @@ -122,8 +131,9 @@ > {#if ariaLabel}