From 1c45bc615f707ebe74085b57ae76526a1897e386 Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Fri, 6 Nov 2015 16:46:07 +0000 Subject: [PATCH] Enable touch-menu for links so they can be deleted --- editor/js/ui/view.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/editor/js/ui/view.js b/editor/js/ui/view.js index 508ed762c..2c75c8c67 100644 --- a/editor/js/ui/view.js +++ b/editor/js/ui/view.js @@ -1065,7 +1065,7 @@ RED.view = (function() { function showTouchMenu(obj,pos) { var mdn = mousedown_node; var options = []; - options.push({name:"delete",disabled:(moving_set.length===0),onselect:function() {deleteSelection();}}); + options.push({name:"delete",disabled:(moving_set.length===0 && selected_link === null),onselect:function() {deleteSelection();}}); options.push({name:"cut",disabled:(moving_set.length===0),onselect:function() {copySelection();deleteSelection();}}); options.push({name:"copy",disabled:(moving_set.length===0),onselect:function() {copySelection();}}); options.push({name:"paste",disabled:(clipboard.length===0),onselect:function() {importNodes(clipboard,true);}}); @@ -1610,6 +1610,14 @@ RED.view = (function() { redraw(); focusView(); d3.event.stopPropagation(); + + var obj = d3.select(document.body); + var touch0 = d3.event.touches.item(0); + var pos = [touch0.pageX,touch0.pageY]; + touchStartTime = setTimeout(function() { + touchStartTime = null; + showTouchMenu(obj,pos); + },touchLongPressTimeout); }); l.append("svg:path").attr("class","link_outline link_path"); l.append("svg:path").attr("class","link_line link_path")