mirror of
https://github.com/node-red/node-red
synced 2024-11-21 23:48:30 +00:00
Add select-connected action
This commit is contained in:
parent
d5314d2a85
commit
35f788693d
@ -46,6 +46,8 @@
|
||||
"ctrl-a": "core:select-all-nodes",
|
||||
"alt-s u": "core:select-upstream-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",
|
||||
"w": "core:scroll-view-up",
|
||||
"d": "core:scroll-view-right",
|
||||
|
@ -16,6 +16,21 @@
|
||||
|
||||
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() {
|
||||
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-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-upstream-nodes", selectUpstream);
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user