diff --git a/CHANGELOG.md b/CHANGELOG.md index f72c6067b..a92365ad9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -38,7 +38,7 @@ Editor - hide unused input field (#2823) - Implement node property typing (#2812) @knolleary - 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 - Prevent duplicate keyboard shortcut from being assigned - Prevent rogue mouseup on tab from triggering tab change diff --git a/packages/node_modules/@node-red/editor-client/src/js/nodes.js b/packages/node_modules/@node-red/editor-client/src/js/nodes.js index 1729be177..fd6296ef2 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/nodes.js +++ b/packages/node_modules/@node-red/editor-client/src/js/nodes.js @@ -31,7 +31,7 @@ RED.nodes = (function() { var groups = {}; var groupsByZ = {}; -RED.nl = nodeLinks; + var initialLoad; var dirty = false; @@ -618,25 +618,27 @@ RED.nl = nodeLinks; } function getAllDownstreamNodes(node) { - return getAllFlowNodes(node,'down'); + return getAllFlowNodes(node,'down').filter(function(n) { return n !== node }); } function getAllUpstreamNodes(node) { - return getAllFlowNodes(node,'up'); + return getAllFlowNodes(node,'up').filter(function(n) { return n !== node }); } function getAllFlowNodes(node, direction) { var selection = RED.view.selection(); var visited = new Set(); var nodes = [node]; + var initialNode = true; while(nodes.length > 0) { var n = nodes.shift(); visited.add(n); var links = []; - if (!direction || direction === 'up') { + if (!initialNode || !direction || (initialNode && direction === 'up')) { links = links.concat(nodeLinks[n.id].in); } - if (!direction || direction === 'down') { + if (!initialNode || !direction || (initialNode && direction === 'down')) { links = links.concat(nodeLinks[n.id].out); } + initialNode = false; links.forEach(function(l) { if (!visited.has(l.source)) { nodes.push(l.source); diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/view-tools.js b/packages/node_modules/@node-red/editor-client/src/js/ui/view-tools.js index 2d5bbeb63..d169282ba 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/view-tools.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/view-tools.js @@ -26,9 +26,9 @@ RED.view.tools = (function() { if (type === 'all') { connected = RED.nodes.getAllFlowNodes(n); } else if (type === 'up') { - connected = RED.nodes.getAllUpstreamNodes(n); + connected = [n].concat(RED.nodes.getAllUpstreamNodes(n)); } else if (type === 'down') { - connected = RED.nodes.getAllDownstreamNodes(n); + connected = [n].concat(RED.nodes.getAllDownstreamNodes(n)); } connected.forEach(function(nn) { visited.add(nn) }) } diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/view.js b/packages/node_modules/@node-red/editor-client/src/js/ui/view.js index e00972148..e47ddcdc0 100755 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/view.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/view.js @@ -3087,9 +3087,9 @@ RED.view = (function() { var targetEdgeDelta = mousedown_node.w > 30 ? 25 : 8; if (edgeDelta < targetEdgeDelta) { if (clickPosition < 0) { - cnodes = RED.nodes.getAllUpstreamNodes(mousedown_node); + cnodes = [mousedown_node].concat(RED.nodes.getAllUpstreamNodes(mousedown_node)); } else { - cnodes = RED.nodes.getAllDownstreamNodes(mousedown_node); + cnodes = [mousedown_node].concat(RED.nodes.getAllDownstreamNodes(mousedown_node)); } } else { cnodes = RED.nodes.getAllFlowNodes(mousedown_node);