mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-19 22:09:37 +00:00
## Summary Fix group paste position: groups now paste at the cursor location instead of on top of the original. ## Changes - **What**: Added LGraphGroup offset handling in _deserializeItems() position adjustment loop, matching existing LGraphNode and Reroute behavior. ## Screenshots Before: https://github.com/user-attachments/assets/e317af10-8009-4092-9d14-de79316cd853 After: https://github.com/user-attachments/assets/f4ffefd5-519a-4592-812c-c88e3b5940fd ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-9962-fix-LGraphGroup-paste-position-3246d73d365081eea5b2e2507da861de) by [Unito](https://www.unito.io)
45 lines
1.3 KiB
TypeScript
45 lines
1.3 KiB
TypeScript
import { expect } from '@playwright/test'
|
|
|
|
import { comfyPageFixture as test } from '../fixtures/ComfyPage'
|
|
|
|
test.describe('Group Copy Paste', { tag: ['@canvas'] }, () => {
|
|
test.afterEach(async ({ comfyPage }) => {
|
|
await comfyPage.canvasOps.resetView()
|
|
})
|
|
|
|
test('Pasted group is offset from original position', async ({
|
|
comfyPage
|
|
}) => {
|
|
await comfyPage.workflow.loadWorkflow('groups/single_group_only')
|
|
|
|
const titlePos = await comfyPage.page.evaluate(() => {
|
|
const app = window.app!
|
|
const group = app.graph.groups[0]
|
|
const clientPos = app.canvasPosToClientPos([
|
|
group.pos[0] + 50,
|
|
group.pos[1] + 15
|
|
])
|
|
return { x: clientPos[0], y: clientPos[1] }
|
|
})
|
|
await comfyPage.canvas.click({ position: titlePos })
|
|
await comfyPage.nextFrame()
|
|
|
|
await comfyPage.clipboard.copy()
|
|
await comfyPage.clipboard.paste()
|
|
await comfyPage.nextFrame()
|
|
|
|
const positions = await comfyPage.page.evaluate(() =>
|
|
window.app!.graph.groups.map((g: { pos: number[] }) => ({
|
|
x: g.pos[0],
|
|
y: g.pos[1]
|
|
}))
|
|
)
|
|
|
|
expect(positions).toHaveLength(2)
|
|
const dx = Math.abs(positions[0].x - positions[1].x)
|
|
const dy = Math.abs(positions[0].y - positions[1].y)
|
|
expect(dx).toBeCloseTo(50, 0)
|
|
expect(dy).toBeCloseTo(15, 0)
|
|
})
|
|
})
|