mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
[groups] Better ordering of group elements on the DOM
This commit is contained in:
parent
94ef25bbb9
commit
b1d0013214
@ -554,8 +554,10 @@ RED.view = (function() {
|
||||
activeGroups = RED.nodes.groups(activeWorkspace)||[];
|
||||
activeGroups.forEach(function(g) {
|
||||
if (g.g) {
|
||||
g._root = g.g;
|
||||
g._depth = 1;
|
||||
} else {
|
||||
g._root = g.id;
|
||||
g._depth = 0;
|
||||
}
|
||||
});
|
||||
@ -571,15 +573,30 @@ RED.view = (function() {
|
||||
g._depth = parentDepth + 1;
|
||||
changed = true;
|
||||
}
|
||||
} else {
|
||||
console.log("Missing group",g.g);
|
||||
if (g._root !== parentGroup._root) {
|
||||
g._root = parentGroup._root;
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
} while (changed)
|
||||
activeGroups.sort(function(a,b) {
|
||||
return a._depth - b._depth;
|
||||
if (a._root === b._root) {
|
||||
return a._depth - b._depth;
|
||||
} else {
|
||||
return a._root.localeCompare(b._root);
|
||||
}
|
||||
});
|
||||
|
||||
var group = groupLayer.selectAll(".red-ui-flow-group").data(activeGroups,function(d) { return d.id });
|
||||
group.sort(function(a,b) {
|
||||
if (a._root === b._root) {
|
||||
return a._depth - b._depth;
|
||||
} else {
|
||||
return a._root.localeCompare(b._root);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function generateLinkPath(origX,origY, destX, destY, sc) {
|
||||
@ -4126,7 +4143,11 @@ if (DEBUG_EVENTS) { console.warn("nodeMouseDown", mouse_mode,d); }
|
||||
});
|
||||
if (addedGroups) {
|
||||
group.sort(function(a,b) {
|
||||
return a._depth - b._depth;
|
||||
if (a._root === b._root) {
|
||||
return a._depth - b._depth;
|
||||
} else {
|
||||
return a._root.localeCompare(b._root);
|
||||
}
|
||||
})
|
||||
}
|
||||
group[0].reverse();
|
||||
|
Loading…
Reference in New Issue
Block a user