LCOV - code coverage report
Current view: top level - src/components/graph - LinkOverlayCanvas.vue Coverage Total Hit
Test: ComfyUI E2E Coverage Lines: 100.0 % 15 15
Test Date: 2026-11-17 04:17:53

            Line data    Source code
       1              : <template>
       2          830 :   <canvas
       3              :     ref="canvasRef"
       4              :     class="pointer-events-none absolute inset-0 size-full"
       5              :   />
       6              : </template>
       7              : 
       8              : <script setup lang="ts">
       9              : import type { LGraphCanvas } from '@/lib/litegraph/src/LGraphCanvas'
      10              : 
      11              : import { onBeforeUnmount, onMounted, ref, watch } from 'vue'
      12              : 
      13              : import { onCanvasFrame } from '@/lib/litegraph/src/canvas/canvasFrame'
      14              : 
      15              : const { canvas } = defineProps<{
      16              :   canvas: LGraphCanvas
      17              : }>()
      18              : 
      19          830 : const emit = defineEmits<{
      20              :   ready: [canvas: HTMLCanvasElement]
      21              :   dispose: []
      22              : }>()
      23              : 
      24          830 : const canvasRef = ref<HTMLCanvasElement | null>(null)
      25              : 
      26        45803 : function matchMainCanvasSize(mainCanvas: HTMLCanvasElement) {
      27        45803 :   const el = canvasRef.value
      28        45803 :   if (!el) return
      29              : 
      30        45803 :   if (el.width !== mainCanvas.width || el.height !== mainCanvas.height) {
      31          890 :     el.width = mainCanvas.width
      32          890 :     el.height = mainCanvas.height
      33              :   }
      34              : }
      35              : 
      36          830 : watch(
      37              :   () => canvas,
      38              :   (canvas, _, onCleanup) => {
      39          830 :     onCleanup(
      40              :       onCanvasFrame(canvas, 'update', () => matchMainCanvasSize(canvas.canvas))
      41              :     )
      42              :   },
      43              :   { immediate: true }
      44              : )
      45              : 
      46          830 : onMounted(() => {
      47          830 :   if (canvasRef.value) emit('ready', canvasRef.value)
      48              : })
      49              : 
      50          830 : onBeforeUnmount(() => {
      51           29 :   emit('dispose')
      52              : })
      53              : </script>
        

Generated by: LCOV version 2.0-1