diff --git a/browser_tests/fixtures/utils/litegraphUtils.ts b/browser_tests/fixtures/utils/litegraphUtils.ts index 832db6324..30b0da08e 100644 --- a/browser_tests/fixtures/utils/litegraphUtils.ts +++ b/browser_tests/fixtures/utils/litegraphUtils.ts @@ -79,48 +79,15 @@ export class SubgraphSlotReference { const node = type === 'input' ? currentGraph.inputNode : currentGraph.outputNode - const slots = - type === 'input' ? currentGraph.inputs : currentGraph.outputs if (!node) { throw new Error(`No ${type} node found in subgraph`) } - // Calculate position for next available slot - // const nextSlotIndex = slots?.length || 0 - // const slotHeight = 20 - // const slotY = node.pos[1] + 30 + nextSlotIndex * slotHeight - - // Find last slot position - const lastSlot = slots.at(-1) - let slotX: number - let slotY: number - - if (lastSlot) { - // If there are existing slots, position the new one below the last one - const gapHeight = 20 - slotX = lastSlot.pos[0] - slotY = lastSlot.pos[1] + gapHeight - } else { - // No existing slots - use slotAnchorX if available, otherwise calculate from node position - if (currentGraph.slotAnchorX !== undefined) { - // The actual slot X position seems to be slotAnchorX - 10 - slotX = currentGraph.slotAnchorX - 10 - } else { - // Fallback: calculate from node edge - slotX = - type === 'input' - ? node.pos[0] + node.size[0] - 10 // Right edge for input node - : node.pos[0] + 10 // Left edge for output node - } - // For Y position when no slots exist, use middle of node - slotY = node.pos[1] + node.size[1] / 2 - } - // Convert from offset to canvas coordinates const canvasPos = window['app'].canvas.ds.convertOffsetToCanvas([ - slotX, - slotY + node.emptySlot.pos[0], + node.emptySlot.pos[1] ]) return canvasPos }, diff --git a/browser_tests/tests/vueNodes/groups/groups.spec.ts-snapshots/vue-groups-create-group-chromium-linux.png b/browser_tests/tests/vueNodes/groups/groups.spec.ts-snapshots/vue-groups-create-group-chromium-linux.png index e8e6180d8..8b8867b31 100644 Binary files a/browser_tests/tests/vueNodes/groups/groups.spec.ts-snapshots/vue-groups-create-group-chromium-linux.png and b/browser_tests/tests/vueNodes/groups/groups.spec.ts-snapshots/vue-groups-create-group-chromium-linux.png differ diff --git a/browser_tests/tests/vueNodes/interactions/canvas/zoom.spec.ts-snapshots/zoomed-in-ctrl-shift-chromium-linux.png b/browser_tests/tests/vueNodes/interactions/canvas/zoom.spec.ts-snapshots/zoomed-in-ctrl-shift-chromium-linux.png index e61668431..de108dd30 100644 Binary files a/browser_tests/tests/vueNodes/interactions/canvas/zoom.spec.ts-snapshots/zoomed-in-ctrl-shift-chromium-linux.png and b/browser_tests/tests/vueNodes/interactions/canvas/zoom.spec.ts-snapshots/zoomed-in-ctrl-shift-chromium-linux.png differ diff --git a/browser_tests/tests/vueNodes/interactions/node/move.spec.ts-snapshots/vue-node-moved-node-chromium-linux.png b/browser_tests/tests/vueNodes/interactions/node/move.spec.ts-snapshots/vue-node-moved-node-chromium-linux.png index e4855509c..0469034c3 100644 Binary files a/browser_tests/tests/vueNodes/interactions/node/move.spec.ts-snapshots/vue-node-moved-node-chromium-linux.png and b/browser_tests/tests/vueNodes/interactions/node/move.spec.ts-snapshots/vue-node-moved-node-chromium-linux.png differ diff --git a/browser_tests/tests/vueNodes/nodeStates/bypass.spec.ts-snapshots/vue-node-bypassed-state-chromium-linux.png b/browser_tests/tests/vueNodes/nodeStates/bypass.spec.ts-snapshots/vue-node-bypassed-state-chromium-linux.png index 10fba2289..e3ae8fad7 100644 Binary files a/browser_tests/tests/vueNodes/nodeStates/bypass.spec.ts-snapshots/vue-node-bypassed-state-chromium-linux.png and b/browser_tests/tests/vueNodes/nodeStates/bypass.spec.ts-snapshots/vue-node-bypassed-state-chromium-linux.png differ diff --git a/browser_tests/tests/vueNodes/nodeStates/colors.spec.ts-snapshots/vue-node-custom-color-blue-chromium-linux.png b/browser_tests/tests/vueNodes/nodeStates/colors.spec.ts-snapshots/vue-node-custom-color-blue-chromium-linux.png index e986d4fd7..e9e99e730 100644 Binary files a/browser_tests/tests/vueNodes/nodeStates/colors.spec.ts-snapshots/vue-node-custom-color-blue-chromium-linux.png and b/browser_tests/tests/vueNodes/nodeStates/colors.spec.ts-snapshots/vue-node-custom-color-blue-chromium-linux.png differ diff --git a/browser_tests/tests/vueNodes/nodeStates/mute.spec.ts-snapshots/vue-node-muted-state-chromium-linux.png b/browser_tests/tests/vueNodes/nodeStates/mute.spec.ts-snapshots/vue-node-muted-state-chromium-linux.png index ab197174d..09ce57b03 100644 Binary files a/browser_tests/tests/vueNodes/nodeStates/mute.spec.ts-snapshots/vue-node-muted-state-chromium-linux.png and b/browser_tests/tests/vueNodes/nodeStates/mute.spec.ts-snapshots/vue-node-muted-state-chromium-linux.png differ diff --git a/src/composables/graph/useGraphNodeManager.ts b/src/composables/graph/useGraphNodeManager.ts index e71e4cf36..db9173058 100644 --- a/src/composables/graph/useGraphNodeManager.ts +++ b/src/composables/graph/useGraphNodeManager.ts @@ -398,6 +398,9 @@ export function useGraphNodeManager(graph: LGraph): GraphNodeManager { vueNodeData.set(id, extractVueNodeData(node)) const initializeVueNodeLayout = () => { + // Check if the node was removed mid-sequence + if (!nodeRefs.has(id)) return + // Extract actual positions after configure() has potentially updated them const nodePosition = { x: node.pos[0], y: node.pos[1] } const nodeSize = { width: node.size[0], height: node.size[1] } @@ -427,7 +430,7 @@ export function useGraphNodeManager(graph: LGraph): GraphNodeManager { } else { // Not during workflow loading - initialize layout immediately // This handles individual node additions during normal operation - initializeVueNodeLayout() + requestAnimationFrame(initializeVueNodeLayout) } // Call original callback if provided