Replace locking/unlocking of canvas with select/pan mode (#1050)

* Add dragging canvas state

* Change icon

* Add playwright test

* tooltip change

* Enable for legacy menu

* Update litegraph

* Hide canvas menu for test
This commit is contained in:
Chenlei Hu
2024-09-30 20:20:49 -04:00
committed by GitHub
parent f75f774ddb
commit 5d957a05b9
8 changed files with 69 additions and 11 deletions

View File

@@ -470,6 +470,8 @@ export class ComfyPage {
'Comfy.NodeBadge.NodeSourceBadgeMode',
NodeBadgeMode.None
)
// Hide canvas menu by default.
await this.setSetting('Comfy.Graph.CanvasMenu', false)
}
public assetPath(fileName: string) {

View File

@@ -347,6 +347,32 @@ test.describe('Canvas Interaction', () => {
await expect(comfyPage.canvas).toHaveScreenshot('panned.png')
})
test('Cursor style changes when panning', async ({ comfyPage }) => {
const getCursorStyle = async () => {
return await comfyPage.page.evaluate(() => {
return (
document.getElementById('graph-canvas')!.style.cursor || 'default'
)
})
}
await comfyPage.page.mouse.move(10, 10)
expect(await getCursorStyle()).toBe('default')
await comfyPage.page.mouse.down()
expect(await getCursorStyle()).toBe('grabbing')
await comfyPage.page.mouse.up()
expect(await getCursorStyle()).toBe('default')
await comfyPage.page.keyboard.down('Space')
expect(await getCursorStyle()).toBe('grab')
await comfyPage.page.mouse.down()
expect(await getCursorStyle()).toBe('grabbing')
await comfyPage.page.mouse.up()
expect(await getCursorStyle()).toBe('grab')
await comfyPage.page.keyboard.up('Space')
expect(await getCursorStyle()).toBe('default')
})
test('Can pan very far and back', async ({ comfyPage }) => {
// intentionally slice the edge of where the clip text encode dom widgets are
await comfyPage.pan({ x: -800, y: -300 }, { x: 1000, y: 10 })