Skip to content

The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.

Handle collapsing to hide element

pythongosssssab7d4f784892
diff --git a/web/scripts/domWidget.js b/web/scripts/domWidget.js
index 16f4e192e..0f8a2eb01 100644
--- a/web/scripts/domWidget.js
+++ b/web/scripts/domWidget.js
@@ -233,6 +233,7 @@ LGraphNode.prototype.addDOMWidget = function (name, type, element, options) {
}
const hidden =
+ node.flags?.collapsed ||
(!!options.hideOnZoom && app.canvas.ds.scale < 0.5) ||
widget.computedHeight <= 0 ||
widget.type === "converted-widget";
@@ -290,6 +291,15 @@ LGraphNode.prototype.addDOMWidget = function (name, type, element, options) {
this.addCustomWidget(widget);
elementWidgets.add(this);
+ const collapse = this.collapse;
+ this.collapse = function() {
+ collapse.apply(this, arguments);
+ if(this.flags?.collapsed) {
+ element.hidden = true;
+ element.style.display = "none";
+ }
+ }
+
const onRemoved = this.onRemoved;
this.onRemoved = function () {
element.remove();