mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Make ctrl-click on nexted group more intuitive
This commit is contained in:
parent
a8e7627184
commit
1aa494a97a
@ -2928,15 +2928,26 @@ RED.view = (function() {
|
|||||||
var nodeGroup = RED.nodes.group(d.g);
|
var nodeGroup = RED.nodes.group(d.g);
|
||||||
|
|
||||||
if (nodeGroup !== activeGroup && (d3.event.ctrlKey || d3.event.metaKey)) {
|
if (nodeGroup !== activeGroup && (d3.event.ctrlKey || d3.event.metaKey)) {
|
||||||
// Clicked on a node in a non-active group with ctrl pressed
|
if (activeGroup && nodeGroup.g === activeGroup.id) {
|
||||||
// - exit active group
|
// Clicked on a node in a non-active group, inside the activeGroup, with ctrl pressed
|
||||||
// - toggle the select state of the group
|
// - add/remove the group from the current selection
|
||||||
exitActiveGroup();
|
groupNodeSelectPrimed = true;
|
||||||
groupNodeSelectPrimed = true;
|
if (nodeGroup.selected) {
|
||||||
if (nodeGroup.selected) {
|
deselectGroup(nodeGroup);
|
||||||
deselectGroup(nodeGroup);
|
} else {
|
||||||
|
selectGroup(nodeGroup,true);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
selectGroup(nodeGroup,true);
|
// Clicked on a node in a non-active group with ctrl pressed
|
||||||
|
// - exit active group
|
||||||
|
// - toggle the select state of the group
|
||||||
|
exitActiveGroup();
|
||||||
|
groupNodeSelectPrimed = true;
|
||||||
|
if (nodeGroup.selected) {
|
||||||
|
deselectGroup(nodeGroup);
|
||||||
|
} else {
|
||||||
|
selectGroup(nodeGroup,true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (nodeGroup === activeGroup ) {
|
} else if (nodeGroup === activeGroup ) {
|
||||||
if (d3.event.shiftKey) {
|
if (d3.event.shiftKey) {
|
||||||
@ -2958,9 +2969,14 @@ RED.view = (function() {
|
|||||||
// Clicked on a node in the active group
|
// Clicked on a node in the active group
|
||||||
if (!d3.event.ctrlKey && !d3.event.metaKey) {
|
if (!d3.event.ctrlKey && !d3.event.metaKey) {
|
||||||
// Ctrl not pressed so clear selection
|
// Ctrl not pressed so clear selection
|
||||||
|
var ag = activeGroup;
|
||||||
clearSelection();
|
clearSelection();
|
||||||
deselectGroup(nodeGroup);
|
deselectGroup(nodeGroup);
|
||||||
selectGroup(nodeGroup,false,false);
|
selectGroup(nodeGroup,false,false);
|
||||||
|
if (ag) {
|
||||||
|
enterActiveGroup(ag);
|
||||||
|
activeGroup.selected = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Select this node
|
// Select this node
|
||||||
@ -2984,18 +3000,18 @@ RED.view = (function() {
|
|||||||
clearSelection();
|
clearSelection();
|
||||||
}
|
}
|
||||||
if (ag) {
|
if (ag) {
|
||||||
if (ag !== nodeGroup) {
|
if (ag !== nodeGroup && ag.id !== nodeGroup.g) {
|
||||||
ag.active = false;
|
ag.active = false;
|
||||||
ag.dirty = true;
|
ag.dirty = true;
|
||||||
} else {
|
} else {
|
||||||
activeGroup = nodeGroup;
|
activeGroup = ag;
|
||||||
activeGroup.active = true;
|
activeGroup.active = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dblClickPrimed = false;
|
dblClickPrimed = false;
|
||||||
}
|
}
|
||||||
selectGroup(nodeGroup, !activeGroup, !!groupNodeSelectPrimed);
|
selectGroup(nodeGroup, !(activeGroup && activeGroup === nodeGroup), !!groupNodeSelectPrimed);
|
||||||
if (activeGroup) {
|
if (activeGroup && activeGroup === nodeGroup) {
|
||||||
mousedown_node.selected = true;
|
mousedown_node.selected = true;
|
||||||
movingSet.add(mousedown_node);
|
movingSet.add(mousedown_node);
|
||||||
}
|
}
|
||||||
@ -3260,7 +3276,12 @@ RED.view = (function() {
|
|||||||
} else {
|
} else {
|
||||||
if (!g.selected) {
|
if (!g.selected) {
|
||||||
if (!d3.event.ctrlKey && !d3.event.metaKey) {
|
if (!d3.event.ctrlKey && !d3.event.metaKey) {
|
||||||
|
var ag = activeGroup;
|
||||||
clearSelection();
|
clearSelection();
|
||||||
|
if (ag && g.g === ag.id) {
|
||||||
|
enterActiveGroup(ag);
|
||||||
|
activeGroup.selected = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (activeGroup) {
|
if (activeGroup) {
|
||||||
if (!RED.group.contains(activeGroup,g)) {
|
if (!RED.group.contains(activeGroup,g)) {
|
||||||
@ -3270,7 +3291,7 @@ RED.view = (function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
selectGroup(g,true);//!wasSelected);
|
selectGroup(g,true);//!wasSelected);
|
||||||
} else {
|
} else if (activeGroup && g.g !== activeGroup.id){
|
||||||
exitActiveGroup();
|
exitActiveGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user