mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-01-26 19:09:52 +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'
|
||||
}"
|
||||
>
|
||||
<ColorPickerButton />
|
||||
<ColorPickerButton v-if="nodeSelected || groupSelected" />
|
||||
<Button
|
||||
v-if="nodeSelected"
|
||||
severity="secondary"
|
||||
@@ -21,6 +21,7 @@
|
||||
</template>
|
||||
</Button>
|
||||
<Button
|
||||
v-if="nodeSelected || groupSelected"
|
||||
severity="secondary"
|
||||
text
|
||||
icon="pi pi-thumbtack"
|
||||
@@ -51,7 +52,7 @@ import ColorPickerButton from '@/components/graph/selectionToolbox/ColorPickerBu
|
||||
import { useRefreshableSelection } from '@/composables/useRefreshableSelection'
|
||||
import { useCommandStore } from '@/stores/commandStore'
|
||||
import { useCanvasStore } from '@/stores/graphStore'
|
||||
import { isLGraphNode } from '@/utils/litegraphUtil'
|
||||
import { isLGraphGroup, isLGraphNode } from '@/utils/litegraphUtil'
|
||||
|
||||
const commandStore = useCommandStore()
|
||||
const canvasStore = useCanvasStore()
|
||||
@@ -59,6 +60,9 @@ const { isRefreshable, refreshSelected } = useRefreshableSelection()
|
||||
const nodeSelected = computed(() =>
|
||||
canvasStore.selectedItems.some(isLGraphNode)
|
||||
)
|
||||
const groupSelected = computed(() =>
|
||||
canvasStore.selectedItems.some(isLGraphGroup)
|
||||
)
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
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 _ from 'lodash'
|
||||
|
||||
@@ -21,8 +21,11 @@ export function addToComboValues(widget: IComboWidget, value: string) {
|
||||
}
|
||||
|
||||
export const isLGraphNode = (item: unknown): item is LGraphNode => {
|
||||
const name = item?.constructor?.name
|
||||
return name === 'ComfyNode' || name === 'LGraphNode'
|
||||
return item instanceof LGraphNode
|
||||
}
|
||||
|
||||
export const isLGraphGroup = (item: unknown): item is LGraphGroup => {
|
||||
return item instanceof LGraphGroup
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user