mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Select links when nodes on either side selected
This commit is contained in:
parent
24b52f09df
commit
bef641609e
@ -128,6 +128,14 @@ RED.view = (function() {
|
||||
if (!setIds.has(node.id)) {
|
||||
set.push({n:node});
|
||||
setIds.add(node.id);
|
||||
var links = RED.nodes.getNodeLinks(node.id,PORT_TYPE_INPUT).concat(RED.nodes.getNodeLinks(node.id,PORT_TYPE_OUTPUT))
|
||||
for (var i=0,l=links.length;i<l;i++) {
|
||||
var link = links[i]
|
||||
if (link.source === node && setIds.has(link.target.id) ||
|
||||
link.target === node && setIds.has(link.source.id)) {
|
||||
selectedLinks.add(link)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -144,6 +152,10 @@ RED.view = (function() {
|
||||
}
|
||||
}
|
||||
}
|
||||
var links = RED.nodes.getNodeLinks(node.id,PORT_TYPE_INPUT).concat(RED.nodes.getNodeLinks(node.id,PORT_TYPE_OUTPUT))
|
||||
for (var i=0,l=links.length;i<l;i++) {
|
||||
selectedLinks.remove(links[i]);
|
||||
}
|
||||
}
|
||||
},
|
||||
clear: function() {
|
||||
@ -1896,6 +1908,7 @@ RED.view = (function() {
|
||||
if (mouse_mode === RED.state.SELECTING_NODE && selectNodesOptions.single) {
|
||||
return;
|
||||
}
|
||||
selectedLinks.clear();
|
||||
|
||||
if (activeGroup) {
|
||||
var ag = activeGroup;
|
||||
@ -1967,7 +1980,6 @@ RED.view = (function() {
|
||||
}
|
||||
}
|
||||
}
|
||||
selectedLinks.clear();
|
||||
if (mouse_mode !== RED.state.SELECTING_NODE) {
|
||||
updateSelection();
|
||||
}
|
||||
@ -3262,7 +3274,7 @@ RED.view = (function() {
|
||||
mousedown_node.selected = true;
|
||||
movingSet.add(mousedown_node);
|
||||
}
|
||||
selectedLinks.clear();
|
||||
// selectedLinks.clear();
|
||||
if (d3.event.button != 2) {
|
||||
mouse_mode = RED.state.MOVING;
|
||||
var mouse = d3.touches(this)[0]||d3.mouse(this);
|
||||
@ -3390,7 +3402,7 @@ RED.view = (function() {
|
||||
}
|
||||
mousedown_link = d;
|
||||
|
||||
if (selectedLinks.length() === 0 || !(d3.event.metaKey || d3.event.ctrlKey)) {
|
||||
if (!(d3.event.metaKey || d3.event.ctrlKey)) {
|
||||
clearSelection();
|
||||
}
|
||||
if (d3.event.metaKey || d3.event.ctrlKey) {
|
||||
@ -3408,7 +3420,7 @@ RED.view = (function() {
|
||||
redraw();
|
||||
focusView();
|
||||
d3.event.stopPropagation();
|
||||
if (!mousedown_link.link && selectedLinks.length() === 1 && selectedLinks.has(mousedown_link) && (d3.event.metaKey || d3.event.ctrlKey)) {
|
||||
if (!mousedown_link.link && movingSet.length() === 0 && selectedLinks.length() === 1 && selectedLinks.has(mousedown_link) && (d3.event.metaKey || d3.event.ctrlKey)) {
|
||||
d3.select(this).classed("red-ui-flow-link-splice",true);
|
||||
var point = d3.mouse(this);
|
||||
var clickedGroup = getGroupAt(point[0],point[1]);
|
||||
|
Loading…
Reference in New Issue
Block a user