mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Add select-connected action
This commit is contained in:
parent
d5314d2a85
commit
35f788693d
@ -46,6 +46,8 @@
|
|||||||
"ctrl-a": "core:select-all-nodes",
|
"ctrl-a": "core:select-all-nodes",
|
||||||
"alt-s u": "core:select-upstream-nodes",
|
"alt-s u": "core:select-upstream-nodes",
|
||||||
"alt-s d": "core:select-downstream-nodes",
|
"alt-s d": "core:select-downstream-nodes",
|
||||||
|
"alt-s c": "core:select-connected-nodes",
|
||||||
|
"alt-s d": "core:select-downstream-nodes",
|
||||||
"shift-?": "core:show-help",
|
"shift-?": "core:show-help",
|
||||||
"w": "core:scroll-view-up",
|
"w": "core:scroll-view-up",
|
||||||
"d": "core:scroll-view-right",
|
"d": "core:scroll-view-right",
|
||||||
|
@ -16,6 +16,21 @@
|
|||||||
|
|
||||||
RED.view.tools = (function() {
|
RED.view.tools = (function() {
|
||||||
|
|
||||||
|
function selectAllConnected() {
|
||||||
|
console.log(args);
|
||||||
|
var selection = RED.view.selection();
|
||||||
|
var visited = new Set();
|
||||||
|
if (selection.nodes && selection.nodes.length > 0) {
|
||||||
|
selection.nodes.forEach(function(n) {
|
||||||
|
if (!visited.has(n)) {
|
||||||
|
var connected = RED.nodes.getAllFlowNodes(n);
|
||||||
|
connected.forEach(function(nn) { visited.add(nn) })
|
||||||
|
}
|
||||||
|
});
|
||||||
|
RED.view.select({nodes:Array.from(visited)});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
function selectDownstream() {
|
function selectDownstream() {
|
||||||
selectStream('source','target')
|
selectStream('source','target')
|
||||||
@ -241,6 +256,7 @@ RED.view.tools = (function() {
|
|||||||
RED.actions.add("core:step-selection-down", function() { moveSelection(0,RED.view.gridSize());});
|
RED.actions.add("core:step-selection-down", function() { moveSelection(0,RED.view.gridSize());});
|
||||||
RED.actions.add("core:step-selection-left", function() { moveSelection(-RED.view.gridSize(),0);});
|
RED.actions.add("core:step-selection-left", function() { moveSelection(-RED.view.gridSize(),0);});
|
||||||
|
|
||||||
|
RED.actions.add("core:select-connected-nodes", selectAllConnected);
|
||||||
RED.actions.add("core:select-downstream-nodes", selectDownstream);
|
RED.actions.add("core:select-downstream-nodes", selectDownstream);
|
||||||
RED.actions.add("core:select-upstream-nodes", selectUpstream);
|
RED.actions.add("core:select-upstream-nodes", selectUpstream);
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user