mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-01-26 10:59:53 +00:00
## Summary Automated initial change, cleaned up manually. Please check the screenshot changes. Includes a11y updates to icon buttons. Doesn't hit the buttons in Desktop. ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-7649-WIP-Component-The-Rest-of-the-PrimeVue-buttons-2ce6d73d365081d68e06f200f1321267) by [Unito](https://www.unito.io) --------- Co-authored-by: GitHub Action <action@github.com> Co-authored-by: github-actions <github-actions@github.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
67 lines
1.8 KiB
Vue
67 lines
1.8 KiB
Vue
<template>
|
|
<Button
|
|
v-tooltip.top="{
|
|
value: t('selectionToolbox.executeButton.tooltip'),
|
|
showDelay: 1000
|
|
}"
|
|
variant="primary"
|
|
:aria-label="t('selectionToolbox.executeButton.tooltip')"
|
|
@mouseenter="() => handleMouseEnter()"
|
|
@mouseleave="() => handleMouseLeave()"
|
|
@click="handleClick"
|
|
>
|
|
<i class="icon-[lucide--play]" />
|
|
</Button>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import { computed, ref } from 'vue'
|
|
import { useI18n } from 'vue-i18n'
|
|
|
|
import Button from '@/components/ui/button/Button.vue'
|
|
import { useSelectionState } from '@/composables/graph/useSelectionState'
|
|
import type { LGraphNode } from '@/lib/litegraph/src/litegraph'
|
|
import { useCanvasStore } from '@/renderer/core/canvas/canvasStore'
|
|
import { useCommandStore } from '@/stores/commandStore'
|
|
import { isLGraphNode } from '@/utils/litegraphUtil'
|
|
import { isOutputNode } from '@/utils/nodeFilterUtil'
|
|
|
|
const { t } = useI18n()
|
|
const commandStore = useCommandStore()
|
|
const canvasStore = useCanvasStore()
|
|
const { selectedNodes } = useSelectionState()
|
|
|
|
const canvas = canvasStore.getCanvas()
|
|
const buttonHovered = ref(false)
|
|
const selectedOutputNodes = computed(() =>
|
|
selectedNodes.value.filter(isLGraphNode).filter(isOutputNode)
|
|
)
|
|
|
|
function outputNodeStokeStyle(this: LGraphNode) {
|
|
if (
|
|
this.selected &&
|
|
this.constructor.nodeData?.output_node &&
|
|
buttonHovered.value
|
|
) {
|
|
return { color: 'orange', lineWidth: 2, padding: 10 }
|
|
}
|
|
}
|
|
|
|
const handleMouseEnter = () => {
|
|
buttonHovered.value = true
|
|
for (const node of selectedOutputNodes.value) {
|
|
node.strokeStyles['outputNode'] = outputNodeStokeStyle
|
|
}
|
|
canvas.setDirty(true)
|
|
}
|
|
|
|
const handleMouseLeave = () => {
|
|
buttonHovered.value = false
|
|
canvas.setDirty(true)
|
|
}
|
|
|
|
const handleClick = async () => {
|
|
await commandStore.execute('Comfy.QueueSelectedOutputNodes')
|
|
}
|
|
</script>
|