Skip to content

Commit 00c2181

Browse files
authored
Show warning toast when no items are selected (#3741)
1 parent 743f3cb commit 00c2181

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/components/graph/GraphCanvas.vue

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545

4646
<script setup lang="ts">
4747
import type { LGraphNode } from '@comfyorg/litegraph'
48+
import { useEventListener } from '@vueuse/core'
4849
import { computed, onMounted, ref, watch, watchEffect } from 'vue'
4950
5051
import LiteGraphCanvasSplitterOverlay from '@/components/LiteGraphCanvasSplitterOverlay.vue'
@@ -83,6 +84,7 @@ import { useExecutionStore } from '@/stores/executionStore'
8384
import { useCanvasStore } from '@/stores/graphStore'
8485
import { useNodeDefStore } from '@/stores/nodeDefStore'
8586
import { useSettingStore } from '@/stores/settingStore'
87+
import { useToastStore } from '@/stores/toastStore'
8688
import { useColorPaletteStore } from '@/stores/workspace/colorPaletteStore'
8789
import { useWorkspaceStore } from '@/stores/workspaceStore'
8890
@@ -95,6 +97,7 @@ const nodeDefStore = useNodeDefStore()
9597
const workspaceStore = useWorkspaceStore()
9698
const canvasStore = useCanvasStore()
9799
const executionStore = useExecutionStore()
100+
const toastStore = useToastStore()
98101
const betaMenuEnabled = computed(
99102
() => settingStore.get('Comfy.UseNewMenu') !== 'Disabled'
100103
)
@@ -248,6 +251,19 @@ watch(
248251
}
249252
)
250253
254+
useEventListener(
255+
canvasRef,
256+
'litegraph:no-items-selected',
257+
() => {
258+
toastStore.add({
259+
severity: 'warn',
260+
summary: 'No items selected',
261+
life: 2000
262+
})
263+
},
264+
{ passive: true }
265+
)
266+
251267
const loadCustomNodesI18n = async () => {
252268
try {
253269
const i18nData = await api.getCustomNodesI18n()

0 commit comments

Comments
 (0)