From 7fb8374bccfccc7723f380d1389f2edb6ef70d39 Mon Sep 17 00:00:00 2001 From: Terry Jia Date: Sat, 24 Jan 2026 14:15:32 -0500 Subject: [PATCH] fix: use Reroute.move() to sync layout store on paste --- src/lib/litegraph/src/LGraphCanvas.ts | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/lib/litegraph/src/LGraphCanvas.ts b/src/lib/litegraph/src/LGraphCanvas.ts index 9c9c9455d..fe1cad4b1 100644 --- a/src/lib/litegraph/src/LGraphCanvas.ts +++ b/src/lib/litegraph/src/LGraphCanvas.ts @@ -4027,15 +4027,14 @@ export class LGraphCanvas implements CustomEventDispatcher } } - // Adjust positions + // Adjust positions - use move/setPos to ensure layout store is updated + const dx = position[0] - offsetX + const dy = position[1] - offsetY for (const item of created) { - const newX = item.pos[0] + position[0] - offsetX - const newY = item.pos[1] + position[1] - offsetY if (item instanceof LGraphNode) { - item.setPos(newX, newY) - } else { - item.pos[0] = newX - item.pos[1] = newY + item.setPos(item.pos[0] + dx, item.pos[1] + dy) + } else if (item instanceof Reroute) { + item.move(dx, dy) } }