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.

Fix fit group to nodes with reroute and collapsed nodes

Jairo Correa682c84ccf3fb
diff --git a/web/extensions/core/groupOptions.js b/web/extensions/core/groupOptions.js
index d3d52bf29..5dd21e730 100644
--- a/web/extensions/core/groupOptions.js
+++ b/web/extensions/core/groupOptions.js
@@ -22,6 +22,18 @@ function addNodesToGroup(group, nodes=[]) {
nx2 = node.pos[0] + node.size[0]
ny2 = node.pos[1] + node.size[1]
+ if (node.type != "Reroute") {
+ ny1 -= LiteGraph.NODE_TITLE_HEIGHT;
+ }
+
+ if (node.flags?.collapsed) {
+ ny2 = ny1 + LiteGraph.NODE_TITLE_HEIGHT;
+
+ if (node?._collapsed_width) {
+ nx2 = nx1 + Math.round(node._collapsed_width);
+ }
+ }
+
if (x1 == -1 || nx1 < x1) {
x1 = nx1;
}
@@ -42,7 +54,7 @@ function addNodesToGroup(group, nodes=[]) {
var padding = 10;
- y1 = y1 - Math.round(group.font_size * 2.7);
+ y1 = y1 - Math.round(group.font_size * 1.4);
group.pos = [x1 - padding, y1 - padding];
group.size = [x2 - x1 + padding * 2, y2 - y1 + padding * 2];