From 9e228faccd12e23fc74e43cf8c15cd5e103c7ad6 Mon Sep 17 00:00:00 2001 From: Daniel Lewis Date: Sun, 2 Jun 2024 13:36:05 -0600 Subject: [PATCH] Fix for hidden widgets showing --- web/scripts/domWidget.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/web/scripts/domWidget.js b/web/scripts/domWidget.js index b7f437ad2..3103851e3 100644 --- a/web/scripts/domWidget.js +++ b/web/scripts/domWidget.js @@ -170,7 +170,10 @@ function computeSize(size) { // Override the compute visible nodes function to allow us to hide/show DOM elements when the node goes offscreen const elementWidgets = new Set(); const computeVisibleNodes = LGraphCanvas.prototype.computeVisibleNodes; -LGraphCanvas.prototype.computeVisibleNodes = function () { + +// @TODO: strip this double-assign once code is migrated +LiteGraph.LGraphCanvas.prototype.computeVisibleNodes = +window.LGraphCanvas.prototype.computeVisibleNodes = function () { const visibleNodes = computeVisibleNodes.apply(this, arguments); for (const node of app.graph._nodes) { if (elementWidgets.has(node)) { @@ -204,7 +207,9 @@ export function addDomClippingSetting() { }); } -LGraphNode.prototype.addDOMWidget = function (name, type, element, options) { +// @TODO: strip this double-assign once code is migrated +LiteGraph.LGraphNode.prototype.addDOMWidget = +window.LGraphNode.prototype.addDOMWidget = function (name, type, element, options) { options = { hideOnZoom: true, selectOn: ["focus", "click"], ...options }; if (!element.parentElement) {