From 5bda311f8d79c30344036a5e22e691e2f0cc5d08 Mon Sep 17 00:00:00 2001 From: braks <78412429+bcakmakoglu@users.noreply.github.com> Date: Sat, 4 Nov 2023 17:35:33 +0100 Subject: [PATCH] fix(core): use existing node for intersection check --- packages/core/src/store/actions.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/core/src/store/actions.ts b/packages/core/src/store/actions.ts index 6264f350..66f5d284 100644 --- a/packages/core/src/store/actions.ts +++ b/packages/core/src/store/actions.ts @@ -43,6 +43,7 @@ import { getSelectionChanges, isDef, isEdge, + isGraphNode, isNode, isRect, nodeToRect, @@ -639,7 +640,7 @@ export function useActions( nodeOrRect: (Partial & { id: Node['id'] }) | Rect, ): [Rect | null, Node | null | undefined, boolean] => { const isRectObj = isRect(nodeOrRect) - const node = isRectObj ? null : findNode(nodeOrRect.id) + const node = isRectObj ? null : isGraphNode(nodeOrRect as GraphNode) ? (nodeOrRect as GraphNode) : findNode(nodeOrRect.id) if (!isRectObj && !node) { return [null, null, isRectObj]