mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Ensure select-up/down-stream action follows branches in flows
This commit is contained in:
parent
b5751e5746
commit
15715a2968
@ -38,7 +38,7 @@ Editor
|
|||||||
- hide unused input field (#2823)
|
- hide unused input field (#2823)
|
||||||
- Implement node property typing (#2812) @knolleary
|
- Implement node property typing (#2812) @knolleary
|
||||||
- Improve SemVer comparison in Palette Manager (#2821 #2879) @HaKr
|
- Improve SemVer comparison in Palette Manager (#2821 #2879) @HaKr
|
||||||
- Library: properly handle symlinked folders (#2768) $natcl
|
- Library: properly handle symlinked folders (#2768) @natcl
|
||||||
- make flow download code separate utility instead of polyfill
|
- make flow download code separate utility instead of polyfill
|
||||||
- Prevent duplicate keyboard shortcut from being assigned
|
- Prevent duplicate keyboard shortcut from being assigned
|
||||||
- Prevent rogue mouseup on tab from triggering tab change
|
- Prevent rogue mouseup on tab from triggering tab change
|
||||||
|
@ -31,7 +31,7 @@ RED.nodes = (function() {
|
|||||||
|
|
||||||
var groups = {};
|
var groups = {};
|
||||||
var groupsByZ = {};
|
var groupsByZ = {};
|
||||||
RED.nl = nodeLinks;
|
|
||||||
var initialLoad;
|
var initialLoad;
|
||||||
|
|
||||||
var dirty = false;
|
var dirty = false;
|
||||||
@ -618,25 +618,27 @@ RED.nl = nodeLinks;
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getAllDownstreamNodes(node) {
|
function getAllDownstreamNodes(node) {
|
||||||
return getAllFlowNodes(node,'down');
|
return getAllFlowNodes(node,'down').filter(function(n) { return n !== node });
|
||||||
}
|
}
|
||||||
function getAllUpstreamNodes(node) {
|
function getAllUpstreamNodes(node) {
|
||||||
return getAllFlowNodes(node,'up');
|
return getAllFlowNodes(node,'up').filter(function(n) { return n !== node });
|
||||||
}
|
}
|
||||||
function getAllFlowNodes(node, direction) {
|
function getAllFlowNodes(node, direction) {
|
||||||
var selection = RED.view.selection();
|
var selection = RED.view.selection();
|
||||||
var visited = new Set();
|
var visited = new Set();
|
||||||
var nodes = [node];
|
var nodes = [node];
|
||||||
|
var initialNode = true;
|
||||||
while(nodes.length > 0) {
|
while(nodes.length > 0) {
|
||||||
var n = nodes.shift();
|
var n = nodes.shift();
|
||||||
visited.add(n);
|
visited.add(n);
|
||||||
var links = [];
|
var links = [];
|
||||||
if (!direction || direction === 'up') {
|
if (!initialNode || !direction || (initialNode && direction === 'up')) {
|
||||||
links = links.concat(nodeLinks[n.id].in);
|
links = links.concat(nodeLinks[n.id].in);
|
||||||
}
|
}
|
||||||
if (!direction || direction === 'down') {
|
if (!initialNode || !direction || (initialNode && direction === 'down')) {
|
||||||
links = links.concat(nodeLinks[n.id].out);
|
links = links.concat(nodeLinks[n.id].out);
|
||||||
}
|
}
|
||||||
|
initialNode = false;
|
||||||
links.forEach(function(l) {
|
links.forEach(function(l) {
|
||||||
if (!visited.has(l.source)) {
|
if (!visited.has(l.source)) {
|
||||||
nodes.push(l.source);
|
nodes.push(l.source);
|
||||||
|
@ -26,9 +26,9 @@ RED.view.tools = (function() {
|
|||||||
if (type === 'all') {
|
if (type === 'all') {
|
||||||
connected = RED.nodes.getAllFlowNodes(n);
|
connected = RED.nodes.getAllFlowNodes(n);
|
||||||
} else if (type === 'up') {
|
} else if (type === 'up') {
|
||||||
connected = RED.nodes.getAllUpstreamNodes(n);
|
connected = [n].concat(RED.nodes.getAllUpstreamNodes(n));
|
||||||
} else if (type === 'down') {
|
} else if (type === 'down') {
|
||||||
connected = RED.nodes.getAllDownstreamNodes(n);
|
connected = [n].concat(RED.nodes.getAllDownstreamNodes(n));
|
||||||
}
|
}
|
||||||
connected.forEach(function(nn) { visited.add(nn) })
|
connected.forEach(function(nn) { visited.add(nn) })
|
||||||
}
|
}
|
||||||
|
@ -3087,9 +3087,9 @@ RED.view = (function() {
|
|||||||
var targetEdgeDelta = mousedown_node.w > 30 ? 25 : 8;
|
var targetEdgeDelta = mousedown_node.w > 30 ? 25 : 8;
|
||||||
if (edgeDelta < targetEdgeDelta) {
|
if (edgeDelta < targetEdgeDelta) {
|
||||||
if (clickPosition < 0) {
|
if (clickPosition < 0) {
|
||||||
cnodes = RED.nodes.getAllUpstreamNodes(mousedown_node);
|
cnodes = [mousedown_node].concat(RED.nodes.getAllUpstreamNodes(mousedown_node));
|
||||||
} else {
|
} else {
|
||||||
cnodes = RED.nodes.getAllDownstreamNodes(mousedown_node);
|
cnodes = [mousedown_node].concat(RED.nodes.getAllDownstreamNodes(mousedown_node));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
cnodes = RED.nodes.getAllFlowNodes(mousedown_node);
|
cnodes = RED.nodes.getAllFlowNodes(mousedown_node);
|
||||||
|
Loading…
Reference in New Issue
Block a user