mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-20 14:30:41 +00:00
## Summary When vueNodesMode is enabled, the dragging link preview was rendered on the background canvas behind DOM-based Vue nodes, making it invisible when overlapping node bodies. Add a new overlay canvas layer between TransformPane and SelectionRectangle that renders the dragging link preview and snap highlight above the Vue node DOM layer. Static connections remain on the background canvas as before. fix https://github.com/Comfy-Org/ComfyUI_frontend/issues/8414 discussed with @DrJKL ## Screenshots before https://github.com/user-attachments/assets/94508efa-570c-4e32-a373-360b72625fdd after https://github.com/user-attachments/assets/4b0f924c-66ce-4f49-97d7-51e6e923a1b9 ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-8695-feat-render-dragging-links-above-Vue-nodes-via-overlay-canvas-2ff6d73d365081599b2fe18b87f34b7a) by [Unito](https://www.unito.io) --------- Co-authored-by: github-actions <github-actions@github.com>
44 lines
903 B
Vue
44 lines
903 B
Vue
<template>
|
|
<canvas
|
|
ref="canvasRef"
|
|
class="pointer-events-none absolute inset-0 size-full"
|
|
/>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import type { LGraphCanvas } from '@/lib/litegraph/src/LGraphCanvas'
|
|
|
|
import { useRafFn } from '@vueuse/core'
|
|
import { onBeforeUnmount, onMounted, ref } from 'vue'
|
|
|
|
const { canvas } = defineProps<{
|
|
canvas: LGraphCanvas
|
|
}>()
|
|
|
|
const emit = defineEmits<{
|
|
ready: [canvas: HTMLCanvasElement]
|
|
dispose: []
|
|
}>()
|
|
|
|
const canvasRef = ref<HTMLCanvasElement | null>(null)
|
|
|
|
useRafFn(() => {
|
|
const el = canvasRef.value
|
|
const mainCanvas = canvas.canvas
|
|
if (!el || !mainCanvas) return
|
|
|
|
if (el.width !== mainCanvas.width || el.height !== mainCanvas.height) {
|
|
el.width = mainCanvas.width
|
|
el.height = mainCanvas.height
|
|
}
|
|
})
|
|
|
|
onMounted(() => {
|
|
if (canvasRef.value) emit('ready', canvasRef.value)
|
|
})
|
|
|
|
onBeforeUnmount(() => {
|
|
emit('dispose')
|
|
})
|
|
</script>
|