Enable touch-menu for links so they can be deleted

This commit is contained in:
Nick O'Leary 2015-11-06 16:46:07 +00:00
parent fa7f2606fb
commit 1c45bc615f
1 changed files with 9 additions and 1 deletions

View File

@ -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")