diff --git a/src/components/graph/SelectionToolbox.vue b/src/components/graph/SelectionToolbox.vue index 122d270c85..d6d6e66cb9 100644 --- a/src/components/graph/SelectionToolbox.vue +++ b/src/components/graph/SelectionToolbox.vue @@ -6,96 +6,41 @@ content: 'p-0 flex flex-row' }" > - - - commandStore.execute('Comfy.Canvas.ToggleSelectedNodes.Bypass') - " - > - - - - - commandStore.execute('Comfy.Canvas.ToggleSelected.Pin')" - /> - commandStore.execute('Comfy.Canvas.DeleteSelectedItems')" - /> - - + + + + + + commandStore.execute(command.id)" + :command="command" /> diff --git a/src/components/graph/selectionToolbox/BypassButton.vue b/src/components/graph/selectionToolbox/BypassButton.vue new file mode 100644 index 0000000000..7ae84f8e64 --- /dev/null +++ b/src/components/graph/selectionToolbox/BypassButton.vue @@ -0,0 +1,31 @@ + + commandStore.execute('Comfy.Canvas.ToggleSelectedNodes.Bypass') + " + > + + + + + + + diff --git a/src/components/graph/selectionToolbox/ColorPickerButton.vue b/src/components/graph/selectionToolbox/ColorPickerButton.vue index b994351417..3f7daacf51 100644 --- a/src/components/graph/selectionToolbox/ColorPickerButton.vue +++ b/src/components/graph/selectionToolbox/ColorPickerButton.vue @@ -1,6 +1,7 @@ (showColorPicker = !showColorPicker)" diff --git a/src/components/graph/selectionToolbox/DeleteButton.vue b/src/components/graph/selectionToolbox/DeleteButton.vue new file mode 100644 index 0000000000..d0787e57ba --- /dev/null +++ b/src/components/graph/selectionToolbox/DeleteButton.vue @@ -0,0 +1,22 @@ + + commandStore.execute('Comfy.Canvas.DeleteSelectedItems')" + /> + + + diff --git a/src/components/graph/selectionToolbox/ExecuteButton.vue b/src/components/graph/selectionToolbox/ExecuteButton.vue index 652230c257..2f2717a690 100644 --- a/src/components/graph/selectionToolbox/ExecuteButton.vue +++ b/src/components/graph/selectionToolbox/ExecuteButton.vue @@ -1,5 +1,6 @@ commandStore.execute(command.id)" + /> + + + diff --git a/src/components/graph/selectionToolbox/PinButton.vue b/src/components/graph/selectionToolbox/PinButton.vue new file mode 100644 index 0000000000..86598339b2 --- /dev/null +++ b/src/components/graph/selectionToolbox/PinButton.vue @@ -0,0 +1,25 @@ + + commandStore.execute('Comfy.Canvas.ToggleSelected.Pin')" + /> + + + diff --git a/src/components/graph/selectionToolbox/RefreshButton.vue b/src/components/graph/selectionToolbox/RefreshButton.vue new file mode 100644 index 0000000000..786fe511f1 --- /dev/null +++ b/src/components/graph/selectionToolbox/RefreshButton.vue @@ -0,0 +1,17 @@ + + + + + diff --git a/src/stores/graphStore.ts b/src/stores/graphStore.ts index a0d929f48b..8d053dde70 100644 --- a/src/stores/graphStore.ts +++ b/src/stores/graphStore.ts @@ -1,7 +1,9 @@ import type { LGraphCanvas, LGraphGroup, LGraphNode } from '@comfyorg/litegraph' import type { Positionable } from '@comfyorg/litegraph/dist/interfaces' import { defineStore } from 'pinia' -import { type Raw, markRaw, ref, shallowRef } from 'vue' +import { type Raw, computed, markRaw, ref, shallowRef } from 'vue' + +import { isLGraphGroup, isLGraphNode } from '@/utils/litegraphUtil' export const useTitleEditorStore = defineStore('titleEditor', () => { const titleEditorTarget = shallowRef(null) @@ -27,6 +29,9 @@ export const useCanvasStore = defineStore('canvas', () => { selectedItems.value = items.map((item) => markRaw(item)) } + const nodeSelected = computed(() => selectedItems.value.some(isLGraphNode)) + const groupSelected = computed(() => selectedItems.value.some(isLGraphGroup)) + const getCanvas = () => { if (!canvas.value) throw new Error('getCanvas: canvas is null') return canvas.value @@ -35,6 +40,8 @@ export const useCanvasStore = defineStore('canvas', () => { return { canvas, selectedItems, + nodeSelected, + groupSelected, updateSelectedItems, getCanvas }