From 34030fed925ca6e11863a0c2f85d84303378e312 Mon Sep 17 00:00:00 2001 From: luke zhang Date: Tue, 28 May 2024 02:26:07 +0800 Subject: [PATCH] improve dom widget performance (#3584) --- web/scripts/domWidget.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/web/scripts/domWidget.js b/web/scripts/domWidget.js index d5eeebdb..b7f437ad 100644 --- a/web/scripts/domWidget.js +++ b/web/scripts/domWidget.js @@ -11,9 +11,10 @@ function intersect(a, b) { else return null; } -function getClipPath(node, element, elRect) { +function getClipPath(node, element) { const selectedNode = Object.values(app.canvas.selected_nodes)[0]; if (selectedNode && selectedNode !== node) { + const elRect = element.getBoundingClientRect(); const MARGIN = 7; const scale = app.canvas.ds.scale; @@ -269,7 +270,7 @@ LGraphNode.prototype.addDOMWidget = function (name, type, element, options) { }); if (enableDomClipping) { - element.style.clipPath = getClipPath(node, element, elRect); + element.style.clipPath = getClipPath(node, element); element.style.willChange = "clip-path"; }