MCPcopy Create free account
hub / github.com/Lightricks/ComfyUI-LTXVideo / toggleWidget

Function toggleWidget

web/js/guider_parameters_advanced.js:23–46  ·  view source on GitHub ↗
(node, widget, show)

Source from the content-addressed store, hash-verified

21const _origProps = {};
22
23function toggleWidget(node, widget, show) {
24 if (!widget) return;
25 if (!_origProps[widget.name]) {
26 _origProps[widget.name] = {
27 origComputeSize: widget.computeSize,
28 };
29 }
30 const origSize = node.size;
31
32 widget.hidden = !show;
33 widget.computeSize = show
34 ? _origProps[widget.name].origComputeSize
35 : () => [0, -3.3];
36
37 widget.linkedWidgets?.forEach((w) => toggleWidget(node, w, show));
38
39 const height = show
40 ? Math.max(node.computeSize()[1], origSize[1])
41 : node.computeSize()[1];
42 node.setSize([node.size[0], height]);
43
44 if (show) delete widget.computedHeight;
45 else widget.computedHeight = 0;
46}
47
48function toggleModalityWidgets(node, prefix, enabled) {
49 for (const w of node.widgets) {

Callers 2

toggleModalityWidgetsFunction · 0.85
nodeCreatedFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected