Pin selected items (Nodes + Groups) (#1427)

* Pin selected items (Nodes + Groups)

* Update litegraph

* Add playwright test

* nit

* Update test expectations [skip ci]

---------

Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
Chenlei Hu
2024-11-04 17:36:33 -05:00
committed by GitHub
parent 3148c90e28
commit 2161ae4e5b
9 changed files with 30 additions and 6 deletions

View File

@@ -9,6 +9,17 @@ test.describe('Item Interaction', () => {
await comfyPage.canvas.press('Delete')
await expect(comfyPage.canvas).toHaveScreenshot('deleted-all.png')
})
test('Can pin/unpin items with keyboard shortcut', async ({ comfyPage }) => {
await comfyPage.loadWorkflow('mixed_graph_items')
await comfyPage.canvas.press('Control+a')
await comfyPage.canvas.press('KeyP')
await comfyPage.nextFrame()
await expect(comfyPage.canvas).toHaveScreenshot('pinned-all.png')
await comfyPage.canvas.press('KeyP')
await comfyPage.nextFrame()
await expect(comfyPage.canvas).toHaveScreenshot('unpinned-all.png')
})
})
test.describe('Node Interaction', () => {

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 77 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

8
package-lock.json generated
View File

@@ -9,7 +9,7 @@
"version": "1.3.32",
"dependencies": {
"@atlaskit/pragmatic-drag-and-drop": "^1.3.1",
"@comfyorg/litegraph": "^0.8.18",
"@comfyorg/litegraph": "^0.8.19",
"@primevue/themes": "^4.0.5",
"@vueuse/core": "^11.0.0",
"axios": "^1.7.4",
@@ -1911,9 +1911,9 @@
"dev": true
},
"node_modules/@comfyorg/litegraph": {
"version": "0.8.18",
"resolved": "https://registry.npmjs.org/@comfyorg/litegraph/-/litegraph-0.8.18.tgz",
"integrity": "sha512-o00MjRX0Env8L8ppjjcE0MEtlgv1mT7D9mPtYzYkUm94u1jnBNpf55q7mXqgp3FkoH9lzpY2JyO87vfVXlgA9w==",
"version": "0.8.19",
"resolved": "https://registry.npmjs.org/@comfyorg/litegraph/-/litegraph-0.8.19.tgz",
"integrity": "sha512-SmeqvljlIwYFCIgdVnvUiPDzPXAt6oWXvh2RJHQZUqSnIxCB73yzHp6vBgz/SwU3PrEL0H14wQMeW8RkcMn9IQ==",
"license": "MIT"
},
"node_modules/@cspotcode/source-map-support": {

View File

@@ -70,7 +70,7 @@
},
"dependencies": {
"@atlaskit/pragmatic-drag-and-drop": "^1.3.1",
"@comfyorg/litegraph": "^0.8.18",
"@comfyorg/litegraph": "^0.8.19",
"@primevue/themes": "^4.0.5",
"@vueuse/core": "^11.0.0",
"axios": "^1.7.4",

View File

@@ -428,6 +428,19 @@ export const useCommandStore = defineStore('command', () => {
})
}
},
{
id: 'Comfy.Canvas.ToggleSelected.Pin',
icon: 'pi pi-pin',
label: 'Pin/Unpin Selected Items',
versionAdded: '1.3.33',
function: () => {
for (const item of app.canvas.selectedItems) {
if (item instanceof LGraphNode || item instanceof LGraphGroup) {
item.pin(!item.pinned)
}
}
}
},
{
id: 'Comfy.Canvas.ToggleSelectedNodes.Collapse',
icon: 'pi pi-minus',

View File

@@ -134,7 +134,7 @@ export const CORE_KEYBINDINGS: Keybinding[] = [
combo: {
key: 'p'
},
commandId: 'Comfy.Canvas.ToggleSelectedNodes.Pin',
commandId: 'Comfy.Canvas.ToggleSelected.Pin',
targetSelector: '#graph-canvas'
},
{