mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-29 10:42:44 +00:00
Only show delete in selection toolbox for reroute (#2670)
This commit is contained in:
@@ -6,7 +6,7 @@
|
|||||||
content: 'p-0 flex flex-row'
|
content: 'p-0 flex flex-row'
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<ColorPickerButton />
|
<ColorPickerButton v-if="nodeSelected || groupSelected" />
|
||||||
<Button
|
<Button
|
||||||
v-if="nodeSelected"
|
v-if="nodeSelected"
|
||||||
severity="secondary"
|
severity="secondary"
|
||||||
@@ -21,6 +21,7 @@
|
|||||||
</template>
|
</template>
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
|
v-if="nodeSelected || groupSelected"
|
||||||
severity="secondary"
|
severity="secondary"
|
||||||
text
|
text
|
||||||
icon="pi pi-thumbtack"
|
icon="pi pi-thumbtack"
|
||||||
@@ -51,7 +52,7 @@ import ColorPickerButton from '@/components/graph/selectionToolbox/ColorPickerBu
|
|||||||
import { useRefreshableSelection } from '@/composables/useRefreshableSelection'
|
import { useRefreshableSelection } from '@/composables/useRefreshableSelection'
|
||||||
import { useCommandStore } from '@/stores/commandStore'
|
import { useCommandStore } from '@/stores/commandStore'
|
||||||
import { useCanvasStore } from '@/stores/graphStore'
|
import { useCanvasStore } from '@/stores/graphStore'
|
||||||
import { isLGraphNode } from '@/utils/litegraphUtil'
|
import { isLGraphGroup, isLGraphNode } from '@/utils/litegraphUtil'
|
||||||
|
|
||||||
const commandStore = useCommandStore()
|
const commandStore = useCommandStore()
|
||||||
const canvasStore = useCanvasStore()
|
const canvasStore = useCanvasStore()
|
||||||
@@ -59,6 +60,9 @@ const { isRefreshable, refreshSelected } = useRefreshableSelection()
|
|||||||
const nodeSelected = computed(() =>
|
const nodeSelected = computed(() =>
|
||||||
canvasStore.selectedItems.some(isLGraphNode)
|
canvasStore.selectedItems.some(isLGraphNode)
|
||||||
)
|
)
|
||||||
|
const groupSelected = computed(() =>
|
||||||
|
canvasStore.selectedItems.some(isLGraphGroup)
|
||||||
|
)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import type { ColorOption, IWidget } from '@comfyorg/litegraph'
|
import type { ColorOption, IWidget } from '@comfyorg/litegraph'
|
||||||
import { LGraphNode, isColorable } from '@comfyorg/litegraph'
|
import { LGraphGroup, LGraphNode, isColorable } from '@comfyorg/litegraph'
|
||||||
import type { IComboWidget } from '@comfyorg/litegraph/dist/types/widgets'
|
import type { IComboWidget } from '@comfyorg/litegraph/dist/types/widgets'
|
||||||
import _ from 'lodash'
|
import _ from 'lodash'
|
||||||
|
|
||||||
@@ -21,8 +21,11 @@ export function addToComboValues(widget: IComboWidget, value: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const isLGraphNode = (item: unknown): item is LGraphNode => {
|
export const isLGraphNode = (item: unknown): item is LGraphNode => {
|
||||||
const name = item?.constructor?.name
|
return item instanceof LGraphNode
|
||||||
return name === 'ComfyNode' || name === 'LGraphNode'
|
}
|
||||||
|
|
||||||
|
export const isLGraphGroup = (item: unknown): item is LGraphGroup => {
|
||||||
|
return item instanceof LGraphGroup
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user