From a3dea6ec0dc92ae2880a035b2fb4361b697f3ad0 Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Fri, 9 May 2014 23:30:00 +0100 Subject: [PATCH] Touch: enable wiring nodes together --- public/red/ui/view.js | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/public/red/ui/view.js b/public/red/ui/view.js index 728fc66ce..6abd365e8 100644 --- a/public/red/ui/view.js +++ b/public/red/ui/view.js @@ -668,10 +668,26 @@ RED.view = function() { function portMouseUp(d,portType,portIndex) { document.body.style.cursor = ""; 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.y-hhmouse_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) { drag_line.attr("class", "drag_line_hidden"); - resetMouseVars(); return; + resetMouseVars(); + return; } var src,dst,src_port; if (mousedown_port_type == 0) {