"docs/img/git@developer.sourcefind.cn:OpenDAS/nni.git" did not exist on "25db55caee4325b3b8ad3e3b48de76f349beeae6"
Commit ab7d4f78 authored by pythongosssss's avatar pythongosssss
Browse files

Handle collapsing to hide element

parent 6ff06fa7
...@@ -233,6 +233,7 @@ LGraphNode.prototype.addDOMWidget = function (name, type, element, options) { ...@@ -233,6 +233,7 @@ LGraphNode.prototype.addDOMWidget = function (name, type, element, options) {
} }
const hidden = const hidden =
node.flags?.collapsed ||
(!!options.hideOnZoom && app.canvas.ds.scale < 0.5) || (!!options.hideOnZoom && app.canvas.ds.scale < 0.5) ||
widget.computedHeight <= 0 || widget.computedHeight <= 0 ||
widget.type === "converted-widget"; widget.type === "converted-widget";
...@@ -290,6 +291,15 @@ LGraphNode.prototype.addDOMWidget = function (name, type, element, options) { ...@@ -290,6 +291,15 @@ LGraphNode.prototype.addDOMWidget = function (name, type, element, options) {
this.addCustomWidget(widget); this.addCustomWidget(widget);
elementWidgets.add(this); 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; const onRemoved = this.onRemoved;
this.onRemoved = function () { this.onRemoved = function () {
element.remove(); element.remove();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment