mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-02 22:37:32 +00:00
Only update widget state when visible (#2954)
This commit is contained in:
@@ -41,19 +41,22 @@ const updateWidgets = () => {
|
||||
|
||||
if (!widgetState) continue
|
||||
|
||||
widgetState.visible =
|
||||
const visible =
|
||||
lgCanvas.isNodeVisible(node) &&
|
||||
!(widget.options.hideOnZoom && lowQuality) &&
|
||||
widget.isVisible()
|
||||
|
||||
widgetState.pos = [node.pos[0] + MARGIN, node.pos[1] + MARGIN + widget.y]
|
||||
widgetState.size = [
|
||||
(widget.width ?? node.width) - MARGIN * 2,
|
||||
(widget.computedHeight ?? 50) - MARGIN * 2
|
||||
]
|
||||
// TODO: optimize this logic as it's O(n), where n is the number of nodes
|
||||
widgetState.zIndex = lgCanvas.graph.nodes.indexOf(node)
|
||||
widgetState.readonly = lgCanvas.read_only
|
||||
widgetState.visible = visible
|
||||
if (visible) {
|
||||
widgetState.pos = [node.pos[0] + MARGIN, node.pos[1] + MARGIN + widget.y]
|
||||
widgetState.size = [
|
||||
(widget.width ?? node.width) - MARGIN * 2,
|
||||
(widget.computedHeight ?? 50) - MARGIN * 2
|
||||
]
|
||||
// TODO: optimize this logic as it's O(n), where n is the number of nodes
|
||||
widgetState.zIndex = lgCanvas.graph.nodes.indexOf(node)
|
||||
widgetState.readonly = lgCanvas.read_only
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user