fixed node bounds calculations if it is an internal node

This commit is contained in:
peterkogo
2024-07-23 16:01:54 +02:00
parent 7f4d56b394
commit 33dbb57aac
3 changed files with 16 additions and 8 deletions
@@ -17,7 +17,8 @@ import {
nodeHasDimensions,
nodeToBox,
getBoundsOfBoxes,
boxToRect
boxToRect,
isInternalNodeBase
} from '@xyflow/system';
import { useStore } from '$lib/store';
@@ -240,7 +241,7 @@ export function useSvelteFlow(): {
*
* @returns the bounds of the given nodes
*/
getNodesBounds: (nodes: (Node | string)[]) => Rect;
getNodesBounds: (nodes: (Node | InternalNode | string)[]) => Rect;
} {
const {
zoomIn,
@@ -532,7 +533,7 @@ export function useSvelteFlow(): {
const internalNode =
typeof node === 'string'
? _nodeLookup.get(node)
: node.parentId
: !isInternalNodeBase(node)
? _nodeLookup.get(node.id)
: node;