mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Allow lasso selection to be restricted to active group
This commit is contained in:
parent
1aa494a97a
commit
85edee288f
@ -1558,17 +1558,28 @@ RED.view = (function() {
|
||||
var y = parseInt(lasso.attr("y"));
|
||||
var x2 = x+parseInt(lasso.attr("width"));
|
||||
var y2 = y+parseInt(lasso.attr("height"));
|
||||
var ag = activeGroup;
|
||||
if (!d3.event.shiftKey) {
|
||||
clearSelection();
|
||||
if (ag) {
|
||||
if (x < ag.x+ag.w && x2 > ag.x && y < ag.y+ag.h && y2 > ag.y) {
|
||||
// There was an active group and the lasso intersects with it,
|
||||
// so reenter the group
|
||||
enterActiveGroup(ag);
|
||||
activeGroup.selected = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
activeGroups.forEach(function(g) {
|
||||
if (!g.selected) {
|
||||
if (g.x > x && g.x+g.w < x2 && g.y > y && g.y+g.h < y2) {
|
||||
while (g.g) {
|
||||
g = RED.nodes.group(g.g);
|
||||
}
|
||||
if (!g.selected) {
|
||||
selectGroup(g,true);
|
||||
if (!activeGroup || RED.group.contains(activeGroup,g)) {
|
||||
while (g.g && (!activeGroup || g.g !== activeGroup.id)) {
|
||||
g = RED.nodes.group(g.g);
|
||||
}
|
||||
if (!g.selected) {
|
||||
selectGroup(g,true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1577,18 +1588,21 @@ RED.view = (function() {
|
||||
activeNodes.forEach(function(n) {
|
||||
if (!n.selected) {
|
||||
if (n.x > x && n.x < x2 && n.y > y && n.y < y2) {
|
||||
if (n.g) {
|
||||
var group = RED.nodes.group(n.g);
|
||||
while (group.g) {
|
||||
group = RED.nodes.group(group.g);
|
||||
if (!activeGroup || RED.group.contains(activeGroup,n)) {
|
||||
if (n.g && (!activeGroup || n.g !== activeGroup.id)) {
|
||||
console.log("HERE")
|
||||
var group = RED.nodes.group(n.g);
|
||||
while (group.g && (!activeGroup || group.g !== activeGroup.id)) {
|
||||
group = RED.nodes.group(group.g);
|
||||
}
|
||||
if (!group.selected) {
|
||||
selectGroup(group,true);
|
||||
}
|
||||
} else {
|
||||
n.selected = true;
|
||||
n.dirty = true;
|
||||
movingSet.add(n);
|
||||
}
|
||||
if (!group.selected) {
|
||||
selectGroup(group,true);
|
||||
}
|
||||
} else {
|
||||
n.selected = true;
|
||||
n.dirty = true;
|
||||
movingSet.add(n);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user