Line data Source code
1 : <script setup lang="ts">
2 : import { useEventListener } from '@vueuse/core'
3 : import { useI18n } from 'vue-i18n'
4 :
5 : import CanvasBanner from '@comfyorg/design-system/common/CanvasBanner'
6 : import Button from '@comfyorg/design-system/button/Button'
7 : import { useCanvasInteractions } from '@/renderer/core/canvas/useCanvasInteractions'
8 : import { useCanvasStore } from '@/renderer/core/canvas/canvasStore'
9 : import { useDialogStore } from '@/stores/dialogStore'
10 :
11 2355 : const { t } = useI18n()
12 2355 : const canvasInteractions = useCanvasInteractions()
13 2355 : const canvasStore = useCanvasStore()
14 2355 : const dialogStore = useDialogStore()
15 :
16 2355 : useEventListener(window, 'keydown', (event: KeyboardEvent) => {
17 1310 : if (event.key === 'Escape' && dialogStore.dialogStack.length === 0)
18 84 : canvasStore.stopNodePicking()
19 : })
20 2355 : </script>
21 :
22 : <template>
23 2355 : <div
24 : class="pointer-events-none absolute top-4 left-1/2 z-40 -translate-x-1/2"
25 : >
26 : <Transition
27 : enter-active-class="transition-[transform,opacity] delay-300 duration-150 ease-out"
28 : leave-active-class="transition-[transform,opacity] duration-150 ease-out"
29 : enter-from-class="-translate-y-full opacity-0"
30 : leave-to-class="-translate-y-full opacity-0"
31 : >
32 : <CanvasBanner
33 : v-if="canvasStore.isPickingNodes"
34 : data-testid="node-selection-mode-banner"
35 : accent="border-l-primary"
36 : class="max-w-lg"
37 : @wheel="canvasInteractions.forwardEventToCanvas"
38 : >
39 : <template #title>{{ t('agent.nodeSelection.bannerTitle') }}</template>
40 : <template #description>
41 : {{ t('agent.nodeSelection.bannerSubtitle') }}
42 : </template>
43 : <template #actions>
44 : <Button
45 : variant="secondary"
46 : size="sm"
47 : @click="canvasStore.stopNodePicking()"
48 : >
49 : {{ t('agent.nodeSelection.exit') }}
50 : </Button>
51 : </template>
52 : </CanvasBanner>
53 : </Transition>
54 : </div>
55 : </template>
|