[Performance] Avoid layout thrashing (#3302)

This commit is contained in:
Chenlei Hu
2025-04-01 14:05:06 -04:00
committed by GitHub
parent 7b7d9905a7
commit b80e0e1a3c
3 changed files with 58 additions and 16 deletions

View File

@@ -17,7 +17,6 @@
</template>
<script setup lang="ts">
import type { LGraphNode } from '@comfyorg/litegraph'
import { useEventListener } from '@vueuse/core'
import { CSSProperties, computed, onMounted, ref, watch } from 'vue'
@@ -63,9 +62,9 @@ const updateDomClipping = () => {
const lgCanvas = canvasStore.canvas
if (!lgCanvas || !widgetElement.value) return
const selectedNode = Object.values(
lgCanvas.selected_nodes ?? {}
)[0] as LGraphNode
const selectedNode = Object.values(lgCanvas.selected_nodes ?? {})[0]
if (!selectedNode) return
const node = widget.node
const isSelected = selectedNode === node
const renderArea = selectedNode?.renderArea