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

Touch: enable wiring nodes together

This commit is contained in:
Nick O'Leary 2014-05-09 23:30:00 +01:00
parent a5cf4b17bf
commit a3dea6ec0d

View File

@ -668,10 +668,26 @@ RED.view = function() {
function portMouseUp(d,portType,portIndex) { function portMouseUp(d,portType,portIndex) {
document.body.style.cursor = ""; document.body.style.cursor = "";
if (mouse_mode == RED.state.JOINING && mousedown_node) { if (mouse_mode == RED.state.JOINING && mousedown_node) {
mouseup_node = d; if (d3.event instanceof TouchEvent) {
RED.nodes.eachNode(function(n) {
if (n.z == activeWorkspace) {
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]) {
mouseup_node = n;
portType = mouseup_node._def.inputs>0?1:0;
portIndex = 0;
}
}
});
} else {
mouseup_node = d;
}
if (portType == mousedown_port_type || mouseup_node === mousedown_node) { if (portType == mousedown_port_type || mouseup_node === mousedown_node) {
drag_line.attr("class", "drag_line_hidden"); drag_line.attr("class", "drag_line_hidden");
resetMouseVars(); return; resetMouseVars();
return;
} }
var src,dst,src_port; var src,dst,src_port;
if (mousedown_port_type == 0) { if (mousedown_port_type == 0) {