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

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',