From b5287b8808acf0f81288d27a553d8fbe5c8c4d79 Mon Sep 17 00:00:00 2001 From: moklick Date: Tue, 14 Oct 2025 16:00:01 +0200 Subject: [PATCH] chore(getInternalNodesBounds): cleanup --- packages/system/src/utils/graph.ts | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/packages/system/src/utils/graph.ts b/packages/system/src/utils/graph.ts index 1b7d27d1..df32a165 100644 --- a/packages/system/src/utils/graph.ts +++ b/packages/system/src/utils/graph.ts @@ -241,25 +241,17 @@ export const getInternalNodesBounds = , params: GetInternalNodesBoundsParams = {} ): Rect => { - const emptyRect = { x: 0, y: 0, width: 0, height: 0 }; - - if (nodeLookup.size === 0) { - return emptyRect; - } - let box = { x: Infinity, y: Infinity, x2: -Infinity, y2: -Infinity }; - let hasVisibleNodes = false; nodeLookup.forEach((node) => { if (params.filter === undefined || params.filter(node)) { + box = getBoundsOfBoxes(box, nodeToBox(node as InternalNodeBase)); hasVisibleNodes = true; - const nodeBox = nodeToBox(node as InternalNodeBase); - box = getBoundsOfBoxes(box, nodeBox); } }); - return hasVisibleNodes ? boxToRect(box) : emptyRect; + return hasVisibleNodes ? boxToRect(box) : { x: 0, y: 0, width: 0, height: 0 }; }; export const getNodesInside = (