Add Fit Group to Contents keybind (#1658)

* Add Fit Group to Nodes keyboard command

Fits all selected groups.

* nit - Rename

* Move to commandStore & Playwright test

* nit

* 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-24 09:15:52 +11:00
committed by GitHub
parent 5febda16c7
commit abed0656af
5 changed files with 117 additions and 0 deletions

View File

@@ -493,6 +493,24 @@ export const useCommandStore = defineStore('command', () => {
function: () => {
useWorkspaceStore().toggleFocusMode()
}
},
{
id: 'Comfy.Graph.FitGroupToContents',
icon: 'pi pi-expand',
label: 'Fit Group To Contents',
versionAdded: '1.4.9',
function: () => {
for (const group of app.canvas.selectedItems) {
if (group instanceof LGraphGroup) {
group.recomputeInsideNodes()
const padding = useSettingStore().get(
'Comfy.GroupSelectedNodes.Padding'
)
group.resizeTo(group.children, padding)
app.graph.change()
}
}
}
}
]