From 97198f5b749e19bd8ead423911b9d611b99e1613 Mon Sep 17 00:00:00 2001 From: pythongosssss <125205205+pythongosssss@users.noreply.github.com> Date: Fri, 24 Mar 2023 16:36:11 +0000 Subject: [PATCH] Restore original size after add/remove input --- web/extensions/core/widgetInputs.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/web/extensions/core/widgetInputs.js b/web/extensions/core/widgetInputs.js index e5bfab83..b699373e 100644 --- a/web/extensions/core/widgetInputs.js +++ b/web/extensions/core/widgetInputs.js @@ -54,14 +54,22 @@ function convertToInput(node, widget, config) { const { linkType } = getWidgetType(config); // Add input and store widget config for creating on primitive node + const sz = node.size; node.addInput(widget.name, linkType, { widget: { name: widget.name, config }, }); + + // Restore original size but grow if needed + node.setSize([Math.max(sz[0], node.size[0]), Math.max(sz[1], node.size[1])]); } function convertToWidget(node, widget) { showWidget(widget); + const sz = node.size; node.removeInput(node.inputs.findIndex((i) => i.widget?.name === widget.name)); + + // Restore original size but grow if needed + node.setSize([Math.max(sz[0], node.size[0]), Math.max(sz[1], node.size[1])]); } function getWidgetType(config) {