From 0c4df3d3f5bca081130409db15c4e5827fe2fe66 Mon Sep 17 00:00:00 2001 From: Comfy Org PR Bot Date: Tue, 23 Dec 2025 02:32:26 +0900 Subject: [PATCH] [backport cloud/1.35] fix: prevent unrelated groups from moving when dragging nodes in vueNodes mode (#7713) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Backport of #7473 to `cloud/1.35` Automatically created by backport workflow. ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-7713-backport-cloud-1-35-fix-prevent-unrelated-groups-from-moving-when-dragging-nodes-in-vu-2d16d73d365081e082e8d9c49add871c) by [Unito](https://www.unito.io) Co-authored-by: Terry Jia --- .../extensions/vueNodes/layout/useNodeDrag.ts | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/renderer/extensions/vueNodes/layout/useNodeDrag.ts b/src/renderer/extensions/vueNodes/layout/useNodeDrag.ts index fb6e86635..9b0cb8c47 100644 --- a/src/renderer/extensions/vueNodes/layout/useNodeDrag.ts +++ b/src/renderer/extensions/vueNodes/layout/useNodeDrag.ts @@ -57,7 +57,10 @@ function useNodeDragIndividual() { const selectedNodes = toValue(selectedNodeIds) // capture the starting positions of all other selected nodes - if (selectedNodes?.has(nodeId) && selectedNodes.size > 1) { + // Only move other selected items if the dragged node is part of the selection + const isDraggedNodeInSelection = selectedNodes?.has(nodeId) + + if (isDraggedNodeInSelection && selectedNodes.size > 1) { otherSelectedNodesStartPositions = new Map() for (const id of selectedNodes) { @@ -73,9 +76,15 @@ function useNodeDragIndividual() { otherSelectedNodesStartPositions = null } - // Capture selected groups (filter from selectedItems which only contains selected items) - selectedGroups = toValue(selectedItems).filter(isLGraphGroup) - lastCanvasDelta = { x: 0, y: 0 } + // Capture selected groups only if the dragged node is part of the selection + // This prevents groups from moving when dragging an unrelated node + if (isDraggedNodeInSelection) { + selectedGroups = toValue(selectedItems).filter(isLGraphGroup) + lastCanvasDelta = { x: 0, y: 0 } + } else { + selectedGroups = null + lastCanvasDelta = null + } mutations.setSource(LayoutSource.Vue) }