1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

[groups] Lasso should select top-most group of selection

This commit is contained in:
Nick O'Leary 2020-03-23 22:04:40 +00:00
parent f0038e9796
commit 64af1f7e9b
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -1453,15 +1453,16 @@ if (DEBUG_EVENTS) { console.warn("canvasMouseUp", mouse_mode); }
if (!d3.event.shiftKey) { if (!d3.event.shiftKey) {
clearSelection(); clearSelection();
} }
var selectedGroups = [];
activeNodes.forEach(function(n) { activeNodes.forEach(function(n) {
if (n.z == RED.workspaces.active() && !n.selected) { if (!n.selected) {
if (n.x > x && n.x < x2 && n.y > y && n.y < y2) { if (n.x > x && n.x < x2 && n.y > y && n.y < y2) {
if (n.g) { if (n.g) {
var group = RED.nodes.group(n.g); var group = RED.nodes.group(n.g);
while (group.g) {
group = RED.nodes.group(group.g);
}
if (!group.selected) { if (!group.selected) {
selectGroup(group,true); selectGroup(group,true);
selectedGroups.push(group)
} }
} else { } else {
n.selected = true; n.selected = true;
@ -1471,16 +1472,16 @@ if (DEBUG_EVENTS) { console.warn("canvasMouseUp", mouse_mode); }
} }
} }
}); });
var selectionChanged = false; // var selectionChanged = false;
do { // do {
selectionChanged = false; // selectionChanged = false;
selectedGroups.forEach(function(g) { // selectedGroups.forEach(function(g) {
if (g.g && g.selected && RED.nodes.group(g.g).selected) { // if (g.g && g.selected && RED.nodes.group(g.g).selected) {
g.selected = false; // g.selected = false;
selectionChanged = true; // selectionChanged = true;
} // }
}) // })
} while(selectionChanged); // } while(selectionChanged);
if (activeSubflow) { if (activeSubflow) {
activeSubflow.in.forEach(function(n) { activeSubflow.in.forEach(function(n) {