mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-01-30 12:59:55 +00:00
## Summary Fixes issue when dragging a group that had inner groups when in vue mode. When dragging the outer group in Vue mode: 1. getAllNestedItems(selected) returns ALL items: outer group + inner groups + nodes 2. moveChildNodesInGroupVueMode loops through all items 3. For outer group G1: calls G1.move(delta, true) then moveGroupChildren(G1, ...) 4. moveGroupChildren calls G2.move(delta) (no skipChildren) - this moves G2 AND G2's children! 5. Then the loop reaches G2: calls G2.move(delta, true) - moves G2 again 6. Plus moveGroupChildren(G2, ...) processes G2's children again This PR fixes it by adding `skipChildren=true` to the `move` call. ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-7447-fix-inner-groups-being-moved-double-when-moving-outer-group-in-vue-mode-2c86d73d365081ce97abec682f2a8518) by [Unito](https://www.unito.io)
74 lines
2.6 KiB
TypeScript
74 lines
2.6 KiB
TypeScript
import {
|
|
comfyExpect as expect,
|
|
comfyPageFixture as test
|
|
} from '../../../fixtures/ComfyPage'
|
|
|
|
const CREATE_GROUP_HOTKEY = 'Control+g'
|
|
|
|
test.describe('Vue Node Groups', () => {
|
|
test.beforeEach(async ({ comfyPage }) => {
|
|
await comfyPage.setSetting('Comfy.VueNodes.Enabled', true)
|
|
await comfyPage.setSetting('Comfy.Minimap.ShowGroups', true)
|
|
await comfyPage.vueNodes.waitForNodes()
|
|
})
|
|
|
|
test('should allow creating groups with hotkey', async ({ comfyPage }) => {
|
|
await comfyPage.page.getByText('Load Checkpoint').click()
|
|
await comfyPage.page.getByText('KSampler').click({ modifiers: ['Control'] })
|
|
await comfyPage.page.keyboard.press(CREATE_GROUP_HOTKEY)
|
|
await comfyPage.nextFrame()
|
|
await expect(comfyPage.canvas).toHaveScreenshot(
|
|
'vue-groups-create-group.png'
|
|
)
|
|
})
|
|
|
|
test('should allow fitting group to contents', async ({ comfyPage }) => {
|
|
await comfyPage.setup()
|
|
await comfyPage.loadWorkflow('groups/oversized_group')
|
|
await comfyPage.ctrlA()
|
|
await comfyPage.executeCommand('Comfy.Graph.FitGroupToContents')
|
|
await comfyPage.nextFrame()
|
|
await expect(comfyPage.canvas).toHaveScreenshot(
|
|
'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')
|
|
|
|
// Get initial positions with null guards
|
|
const outerInitial = await comfyPage.getGroupPosition('Outer Group')
|
|
const innerInitial = await comfyPage.getGroupPosition('Inner Group')
|
|
|
|
const initialOffsetX = innerInitial.x - outerInitial.x
|
|
const initialOffsetY = innerInitial.y - outerInitial.y
|
|
|
|
// Drag the outer group
|
|
const dragDelta = { x: 100, y: 80 }
|
|
await comfyPage.dragGroup({
|
|
name: 'Outer Group',
|
|
deltaX: dragDelta.x,
|
|
deltaY: dragDelta.y
|
|
})
|
|
|
|
// Use retrying assertion to wait for positions to update
|
|
await expect(async () => {
|
|
const outerFinal = await comfyPage.getGroupPosition('Outer Group')
|
|
const innerFinal = await comfyPage.getGroupPosition('Inner Group')
|
|
|
|
const finalOffsetX = innerFinal.x - outerFinal.x
|
|
const finalOffsetY = innerFinal.y - outerFinal.y
|
|
|
|
// Both groups should have moved
|
|
expect(outerFinal.x).not.toBe(outerInitial.x)
|
|
expect(innerFinal.x).not.toBe(innerInitial.x)
|
|
|
|
// The relative offset should be maintained (inner group moved with outer)
|
|
expect(finalOffsetX).toBeCloseTo(initialOffsetX, 0)
|
|
expect(finalOffsetY).toBeCloseTo(initialOffsetY, 0)
|
|
}).toPass({ timeout: 5000 })
|
|
})
|
|
})
|