Hint for empty canvas when invoking Comfy.Canvas.FitView (#1826)

This commit is contained in:
Chenlei Hu
2024-12-06 15:07:01 -08:00
committed by GitHub
parent a6549fb41e
commit 6409e17d4a
3 changed files with 16 additions and 6 deletions

8
package-lock.json generated
View File

@@ -11,7 +11,7 @@
"dependencies": {
"@atlaskit/pragmatic-drag-and-drop": "^1.3.1",
"@comfyorg/comfyui-electron-types": "^0.3.25",
"@comfyorg/litegraph": "^0.8.43",
"@comfyorg/litegraph": "^0.8.44",
"@primevue/themes": "^4.0.5",
"@vueuse/core": "^11.0.0",
"@xterm/addon-fit": "^0.10.0",
@@ -1957,9 +1957,9 @@
"license": "GPL-3.0-only"
},
"node_modules/@comfyorg/litegraph": {
"version": "0.8.43",
"resolved": "https://registry.npmjs.org/@comfyorg/litegraph/-/litegraph-0.8.43.tgz",
"integrity": "sha512-4LH/6inzA6KTs8XqqRha5+lZzVlQq3ZqqHFhdASzGpZHSAERfCiwNjsocRTiObV6gBGLdRxYQO7X7afkHGl2Bg==",
"version": "0.8.44",
"resolved": "https://registry.npmjs.org/@comfyorg/litegraph/-/litegraph-0.8.44.tgz",
"integrity": "sha512-lQqqEO7MXq0DFS5Rer8JJh5t3rajMbBLSeKUg84EPlZjv49nrn8pFwQp439awRrsRg8nPqGCD48Pck0K/Coknw==",
"license": "MIT"
},
"node_modules/@cspotcode/source-map-support": {

View File

@@ -83,7 +83,7 @@
"dependencies": {
"@atlaskit/pragmatic-drag-and-drop": "^1.3.1",
"@comfyorg/comfyui-electron-types": "^0.3.25",
"@comfyorg/litegraph": "^0.8.43",
"@comfyorg/litegraph": "^0.8.44",
"@primevue/themes": "^4.0.5",
"@vueuse/core": "^11.0.0",
"@xterm/addon-fit": "^0.10.0",

View File

@@ -231,7 +231,17 @@ export function useCoreCommands(): ComfyCommand[] {
id: 'Comfy.Canvas.FitView',
icon: 'pi pi-expand',
label: 'Fit view to selected nodes',
function: () => app.canvas.fitViewToSelectionAnimated()
function: () => {
if (app.canvas.empty) {
useToastStore().add({
severity: 'error',
summary: 'Empty canvas',
life: 3000
})
return
}
app.canvas.fitViewToSelectionAnimated()
}
},
{
id: 'Comfy.Canvas.ToggleLock',