Add Litegraph multi-select & group nesting (#1416)

* Allow nested groups

Pass all selected items (new litegraph feature) instead of just selected nodes.

* Allow nested groups - context menus

* Update litegraph

* Update litegraph (Select all / Delete selected)

* Add playwright test

* nit

* Update test expectations [skip ci]

---------

Co-authored-by: huchenlei <huchenlei@proton.me>
Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
filtered
2024-11-04 10:08:42 +11:00
committed by GitHub
parent 0a784d9236
commit 3ba776e6ca
10 changed files with 267 additions and 77 deletions

View File

@@ -361,14 +361,13 @@ export const useCommandStore = defineStore('command', () => {
label: 'Group Selected Nodes',
versionAdded: '1.3.7',
function: () => {
if (
!app.canvas.selected_nodes ||
Object.keys(app.canvas.selected_nodes).length === 0
) {
const { canvas } = app
if (!canvas.selectedItems?.size) {
useToastStore().add({
severity: 'error',
summary: 'No nodes selected',
detail: 'Please select nodes to group',
summary: 'Nothing to group',
detail:
'Please select the nodes (or other groups) to create a group for',
life: 3000
})
return
@@ -377,8 +376,8 @@ export const useCommandStore = defineStore('command', () => {
const padding = useSettingStore().get(
'Comfy.GroupSelectedNodes.Padding'
)
group.addNodes(Object.values(app.canvas.selected_nodes), padding)
app.canvas.graph.add(group)
group.resizeTo(canvas.selectedItems, padding)
canvas.graph.add(group)
useTitleEditorStore().titleEditorTarget = group
}
},