Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 92 additions & 0 deletions browser_tests/assets/groups/nested-groups-1-inner-node.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
{
"id": "2ba0b800-2f13-4f21-b8d6-c6cdb0152cae",
"revision": 0,
"last_node_id": 17,
"last_link_id": 9,
"nodes": [
{
"id": 17,
"type": "VAEDecode",
"pos": [
318.8446183157076,
355.3961392345528
],
"size": [
225,
102
],
"flags": {},
"order": 0,
"mode": 0,
"inputs": [
{
"name": "samples",
"type": "LATENT",
"link": null
},
{
"name": "vae",
"type": "VAE",
"link": null
}
],
"outputs": [
{
"name": "IMAGE",
"type": "IMAGE",
"links": null
}
],
"properties": {
"Node name for S&R": "VAEDecode"
},
"widgets_values": []
}
],
"links": [],
"groups": [
{
"id": 4,
"title": "Outer Group",
"bounding": [
-46.25245366331014,
-150.82497138023245,
1034.4034361963616,
1007.338460439933
],
"color": "#3f789e",
"font_size": 24,
"flags": {}
},
{
"id": 3,
"title": "Inner Group",
"bounding": [
80.96059074101554,
28.123757436778178,
718.286373661183,
691.2397164539732
],
"color": "#3f789e",
"font_size": 24,
"flags": {}
}
],
"config": {},
"extra": {
"ds": {
"scale": 0.7121393732101533,
"offset": [
289.18242848011835,
367.0747755524199
]
},
"frontendVersion": "1.35.5",
"VHS_latentpreview": false,
"VHS_latentpreviewrate": 0,
"VHS_MetadataImage": true,
"VHS_KeepIntermediate": true,
"workflowRendererVersion": "Vue"
},
"version": 0.4
}
56 changes: 56 additions & 0 deletions browser_tests/tests/vueNodes/groups/groups.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,60 @@ test.describe('Vue Node Groups', () => {
'vue-groups-fit-to-contents.png'
)
})

test('should move nested groups together when dragging outer group', async ({
comfyPage
}) => {
await comfyPage.loadWorkflow('groups/nested-groups-1-inner-node')
await comfyPage.nextFrame()

// Get group positions and screen coordinates for outer group
const getGroupData = () =>
comfyPage.page.evaluate(() => {
const canvas = window['app'].canvas
const groups = window['app'].graph.groups
const outerGroup = groups.find(
(g: { title: string }) => g.title === 'Outer Group'
)
const innerGroup = groups.find(
(g: { title: string }) => g.title === 'Inner Group'
)

// Convert outer group title position to screen coordinates
const screenPos = canvas.convertCanvasToOffset([
outerGroup.pos[0] + 50,
outerGroup.pos[1] + 15
])

return {
outer: { x: outerGroup.pos[0], y: outerGroup.pos[1] },
inner: { x: innerGroup.pos[0], y: innerGroup.pos[1] },
screenPos: { x: screenPos[0], y: screenPos[1] }
}
})
Comment thread
christian-byrne marked this conversation as resolved.
Outdated

const initial = await getGroupData()
const initialOffsetX = initial.inner.x - initial.outer.x
const initialOffsetY = initial.inner.y - initial.outer.y

// Drag the outer group by its title area
const dragDelta = { x: 100, y: 80 }
await comfyPage.dragAndDrop(initial.screenPos, {
x: initial.screenPos.x + dragDelta.x,
y: initial.screenPos.y + dragDelta.y
})

// Get final positions
const final = await getGroupData()
const finalOffsetX = final.inner.x - final.outer.x
const finalOffsetY = final.inner.y - final.outer.y

// The relative offset should be maintained (inner group moved with outer)
expect(finalOffsetX).toBeCloseTo(initialOffsetX, 0)
expect(finalOffsetY).toBeCloseTo(initialOffsetY, 0)

// Both groups should have moved
expect(final.outer.x).not.toBe(initial.outer.x)
expect(final.inner.x).not.toBe(initial.inner.x)
})
Comment thread
coderabbitai[bot] marked this conversation as resolved.
})
4 changes: 3 additions & 1 deletion src/lib/litegraph/src/LGraphCanvas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8566,7 +8566,9 @@ export class LGraphCanvas implements CustomEventDispatcher<LGraphCanvasEventMap>
})
} else {
// Non-node children (nested groups, reroutes)
child.move(deltaX, deltaY)
// Use skipChildren=true to avoid double-moving: nested groups will be
// processed in the main loop of moveChildNodesInGroupVueMode
child.move(deltaX, deltaY, true)
}
}
}
Expand Down
Loading