1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Fix connecting wires to subflow status or io ports on touchscreen

This commit is contained in:
Nick O'Leary 2020-07-08 13:22:26 +01:00
parent 6df26f2400
commit 1c337f6817
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -2328,18 +2328,45 @@ RED.view = (function() {
document.body.style.cursor = ""; document.body.style.cursor = "";
if (mouse_mode == RED.state.JOINING || mouse_mode == RED.state.QUICK_JOINING) { if (mouse_mode == RED.state.JOINING || mouse_mode == RED.state.QUICK_JOINING) {
if (typeof TouchEvent != "undefined" && evt instanceof TouchEvent) { if (typeof TouchEvent != "undefined" && evt instanceof TouchEvent) {
var found = false;
RED.nodes.eachNode(function(n) { RED.nodes.eachNode(function(n) {
if (n.z == RED.workspaces.active()) { if (n.z == RED.workspaces.active()) {
var hw = n.w/2; var hw = n.w/2;
var hh = n.h/2; var hh = n.h/2;
if (n.x-hw<mouse_position[0] && n.x+hw> mouse_position[0] && if (n.x-hw<mouse_position[0] && n.x+hw> mouse_position[0] &&
n.y-hh<mouse_position[1] && n.y+hh>mouse_position[1]) { n.y-hh<mouse_position[1] && n.y+hh>mouse_position[1]) {
found = true;
mouseup_node = n; mouseup_node = n;
portType = mouseup_node.inputs>0?PORT_TYPE_INPUT:PORT_TYPE_OUTPUT; portType = mouseup_node.inputs>0?PORT_TYPE_INPUT:PORT_TYPE_OUTPUT;
portIndex = 0; portIndex = 0;
} }
} }
}); });
if (!found && activeSubflow) {
var subflowPorts = [];
if (activeSubflow.status) {
subflowPorts.push(activeSubflow.status)
}
if (activeSubflow.in) {
subflowPorts = subflowPorts.concat(activeSubflow.in)
}
if (activeSubflow.out) {
subflowPorts = subflowPorts.concat(activeSubflow.out)
}
for (var i=0;i<subflowPorts.length;i++) {
var n = subflowPorts[i];
var hw = n.w/2;
var hh = n.h/2;
if (n.x-hw<mouse_position[0] && n.x+hw> mouse_position[0] &&
n.y-hh<mouse_position[1] && n.y+hh>mouse_position[1]) {
found = true;
mouseup_node = n;
portType = mouseup_node.direction === "in"?PORT_TYPE_OUTPUT:PORT_TYPE_INPUT;
portIndex = 0;
break;
}
}
}
} else { } else {
mouseup_node = d; mouseup_node = d;
} }