diff --git a/web/extensions/core/rerouteNode.js b/web/extensions/core/rerouteNode.js index c31f63cd0..499a171da 100644 --- a/web/extensions/core/rerouteNode.js +++ b/web/extensions/core/rerouteNode.js @@ -24,9 +24,13 @@ app.registerExtension({ // Ignore wildcard nodes as these will be updated to real types const types = new Set(this.outputs[0].links.map((l) => app.graph.links[l].type).filter((t) => t !== "*")); if (types.size > 1) { + const linksToDisconnect = []; for (let i = 0; i < this.outputs[0].links.length - 1; i++) { const linkId = this.outputs[0].links[i]; const link = app.graph.links[linkId]; + linksToDisconnect.push(link); + } + for (const link of linksToDisconnect) { const node = app.graph.getNodeById(link.target_id); node.disconnectInput(link.target_slot); } diff --git a/web/extensions/core/widgetInputs.js b/web/extensions/core/widgetInputs.js index c356655b0..6b5174968 100644 --- a/web/extensions/core/widgetInputs.js +++ b/web/extensions/core/widgetInputs.js @@ -59,6 +59,10 @@ function convertToInput(node, widget, config) { widget: { name: widget.name, config }, }); + for (const widget of node.widgets) { + widget.last_y += LiteGraph.NODE_SLOT_HEIGHT; + } + // Restore original size but grow if needed node.setSize([Math.max(sz[0], node.size[0]), Math.max(sz[1], node.size[1])]); } @@ -68,6 +72,10 @@ function convertToWidget(node, widget) { const sz = node.size; node.removeInput(node.inputs.findIndex((i) => i.widget?.name === widget.name)); + for (const widget of node.widgets) { + widget.last_y -= LiteGraph.NODE_SLOT_HEIGHT; + } + // Restore original size but grow if needed node.setSize([Math.max(sz[0], node.size[0]), Math.max(sz[1], node.size[1])]); }