mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Fix ctrl-click on wire whilst already in quick-join
This commit is contained in:
parent
17d3a5840d
commit
426fd499ce
@ -841,110 +841,109 @@ RED.view = (function() {
|
|||||||
if (showLabel !== undefined && !/^link (in|out)$/.test(nn._def.type) && !nn._def.defaults.hasOwnProperty("l")) {
|
if (showLabel !== undefined && !/^link (in|out)$/.test(nn._def.type) && !nn._def.defaults.hasOwnProperty("l")) {
|
||||||
nn.l = showLabel;
|
nn.l = showLabel;
|
||||||
}
|
}
|
||||||
if (!spliceLink) {
|
if (quickAddLink) {
|
||||||
if (quickAddLink) {
|
var drag_line = quickAddLink;
|
||||||
var drag_line = quickAddLink;
|
var src = null,dst,src_port;
|
||||||
var src = null,dst,src_port;
|
if (drag_line.portType === PORT_TYPE_OUTPUT && (nn.inputs > 0 || drag_line.virtualLink) ) {
|
||||||
if (drag_line.portType === PORT_TYPE_OUTPUT && (nn.inputs > 0 || drag_line.virtualLink) ) {
|
src = drag_line.node;
|
||||||
src = drag_line.node;
|
src_port = drag_line.port;
|
||||||
src_port = drag_line.port;
|
dst = nn;
|
||||||
dst = nn;
|
} else if (drag_line.portType === PORT_TYPE_INPUT && (nn.outputs > 0 || drag_line.virtualLink)) {
|
||||||
} else if (drag_line.portType === PORT_TYPE_INPUT && (nn.outputs > 0 || drag_line.virtualLink)) {
|
src = nn;
|
||||||
src = nn;
|
dst = drag_line.node;
|
||||||
dst = drag_line.node;
|
src_port = 0;
|
||||||
src_port = 0;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (src !== null) {
|
if (src !== null) {
|
||||||
// Joining link nodes via virual wires. Need to update
|
// Joining link nodes via virual wires. Need to update
|
||||||
// the src and dst links property
|
// the src and dst links property
|
||||||
if (drag_line.virtualLink) {
|
if (drag_line.virtualLink) {
|
||||||
historyEvent = {
|
historyEvent = {
|
||||||
t:'multi',
|
t:'multi',
|
||||||
events: [historyEvent]
|
events: [historyEvent]
|
||||||
}
|
}
|
||||||
var oldSrcLinks = $.extend(true,{},{v:src.links}).v
|
var oldSrcLinks = $.extend(true,{},{v:src.links}).v
|
||||||
var oldDstLinks = $.extend(true,{},{v:dst.links}).v
|
var oldDstLinks = $.extend(true,{},{v:dst.links}).v
|
||||||
src.links.push(dst.id);
|
src.links.push(dst.id);
|
||||||
dst.links.push(src.id);
|
dst.links.push(src.id);
|
||||||
src.dirty = true;
|
src.dirty = true;
|
||||||
dst.dirty = true;
|
dst.dirty = true;
|
||||||
|
|
||||||
historyEvent.events.push({
|
historyEvent.events.push({
|
||||||
t:'edit',
|
t:'edit',
|
||||||
node: src,
|
node: src,
|
||||||
dirty: RED.nodes.dirty(),
|
dirty: RED.nodes.dirty(),
|
||||||
changed: src.changed,
|
changed: src.changed,
|
||||||
changes: {
|
changes: {
|
||||||
links:oldSrcLinks
|
links:oldSrcLinks
|
||||||
}
|
|
||||||
});
|
|
||||||
historyEvent.events.push({
|
|
||||||
t:'edit',
|
|
||||||
node: dst,
|
|
||||||
dirty: RED.nodes.dirty(),
|
|
||||||
changed: dst.changed,
|
|
||||||
changes: {
|
|
||||||
links:oldDstLinks
|
|
||||||
}
|
|
||||||
});
|
|
||||||
src.changed = true;
|
|
||||||
dst.changed = true;
|
|
||||||
} else {
|
|
||||||
var link = {source: src, sourcePort:src_port, target: dst};
|
|
||||||
RED.nodes.addLink(link);
|
|
||||||
historyEvent.links = [link];
|
|
||||||
}
|
|
||||||
if (!keepAdding) {
|
|
||||||
quickAddLink.el.remove();
|
|
||||||
quickAddLink = null;
|
|
||||||
if (mouse_mode === RED.state.QUICK_JOINING) {
|
|
||||||
if (drag_line.portType === PORT_TYPE_OUTPUT && nn.outputs > 0) {
|
|
||||||
showDragLines([{node:nn,port:0,portType:PORT_TYPE_OUTPUT}]);
|
|
||||||
} else if (!quickAddLink && drag_line.portType === PORT_TYPE_INPUT && nn.inputs > 0) {
|
|
||||||
showDragLines([{node:nn,port:0,portType:PORT_TYPE_INPUT}]);
|
|
||||||
} else {
|
|
||||||
resetMouseVars();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
});
|
||||||
quickAddLink.node = nn;
|
historyEvent.events.push({
|
||||||
quickAddLink.port = 0;
|
t:'edit',
|
||||||
}
|
node: dst,
|
||||||
|
dirty: RED.nodes.dirty(),
|
||||||
|
changed: dst.changed,
|
||||||
|
changes: {
|
||||||
|
links:oldDstLinks
|
||||||
|
}
|
||||||
|
});
|
||||||
|
src.changed = true;
|
||||||
|
dst.changed = true;
|
||||||
} else {
|
} else {
|
||||||
hideDragLines();
|
var link = {source: src, sourcePort:src_port, target: dst};
|
||||||
resetMouseVars();
|
RED.nodes.addLink(link);
|
||||||
|
historyEvent.links = [link];
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
if (!keepAdding) {
|
if (!keepAdding) {
|
||||||
|
quickAddLink.el.remove();
|
||||||
|
quickAddLink = null;
|
||||||
if (mouse_mode === RED.state.QUICK_JOINING) {
|
if (mouse_mode === RED.state.QUICK_JOINING) {
|
||||||
if (nn.outputs > 0) {
|
if (drag_line.portType === PORT_TYPE_OUTPUT && nn.outputs > 0) {
|
||||||
showDragLines([{node:nn,port:0,portType:PORT_TYPE_OUTPUT}]);
|
showDragLines([{node:nn,port:0,portType:PORT_TYPE_OUTPUT}]);
|
||||||
} else if (nn.inputs > 0) {
|
} else if (!quickAddLink && drag_line.portType === PORT_TYPE_INPUT && nn.inputs > 0) {
|
||||||
showDragLines([{node:nn,port:0,portType:PORT_TYPE_INPUT}]);
|
showDragLines([{node:nn,port:0,portType:PORT_TYPE_INPUT}]);
|
||||||
} else {
|
} else {
|
||||||
resetMouseVars();
|
resetMouseVars();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
quickAddLink.node = nn;
|
||||||
|
quickAddLink.port = 0;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
hideDragLines();
|
||||||
|
resetMouseVars();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!keepAdding) {
|
||||||
|
if (mouse_mode === RED.state.QUICK_JOINING) {
|
||||||
if (nn.outputs > 0) {
|
if (nn.outputs > 0) {
|
||||||
quickAddLink = {
|
showDragLines([{node:nn,port:0,portType:PORT_TYPE_OUTPUT}]);
|
||||||
node: nn,
|
|
||||||
port: 0,
|
|
||||||
portType: PORT_TYPE_OUTPUT
|
|
||||||
}
|
|
||||||
} else if (nn.inputs > 0) {
|
} else if (nn.inputs > 0) {
|
||||||
quickAddLink = {
|
showDragLines([{node:nn,port:0,portType:PORT_TYPE_INPUT}]);
|
||||||
node: nn,
|
|
||||||
port: 0,
|
|
||||||
portType: PORT_TYPE_INPUT
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
resetMouseVars();
|
resetMouseVars();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if (nn.outputs > 0) {
|
||||||
|
quickAddLink = {
|
||||||
|
node: nn,
|
||||||
|
port: 0,
|
||||||
|
portType: PORT_TYPE_OUTPUT
|
||||||
|
}
|
||||||
|
} else if (nn.inputs > 0) {
|
||||||
|
quickAddLink = {
|
||||||
|
node: nn,
|
||||||
|
port: 0,
|
||||||
|
portType: PORT_TYPE_INPUT
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
resetMouseVars();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
if (spliceLink) {
|
||||||
resetMouseVars();
|
resetMouseVars();
|
||||||
// TODO: DRY - droppable/nodeMouseDown/canvasMouseUp/showQuickAddDialog
|
// TODO: DRY - droppable/nodeMouseDown/canvasMouseUp/showQuickAddDialog
|
||||||
RED.nodes.removeLink(spliceLink);
|
RED.nodes.removeLink(spliceLink);
|
||||||
@ -960,7 +959,7 @@ RED.view = (function() {
|
|||||||
};
|
};
|
||||||
RED.nodes.addLink(link1);
|
RED.nodes.addLink(link1);
|
||||||
RED.nodes.addLink(link2);
|
RED.nodes.addLink(link2);
|
||||||
historyEvent.links = [link1,link2];
|
historyEvent.links = (historyEvent.links || []).concat([link1,link2]);
|
||||||
historyEvent.removedLinks = [spliceLink];
|
historyEvent.removedLinks = [spliceLink];
|
||||||
}
|
}
|
||||||
RED.history.push(historyEvent);
|
RED.history.push(historyEvent);
|
||||||
|
Loading…
Reference in New Issue
Block a user