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

Touch: double tap to edit rather than long-touch

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

View File

@ -38,7 +38,6 @@ RED.view = function() {
moving_set = [], moving_set = [],
dirty = false, dirty = false,
lasso = null, lasso = null,
pressTimer = null,
clickTime = 0, clickTime = 0,
clickElapsed = 0; clickElapsed = 0;
@ -243,7 +242,6 @@ RED.view = function() {
} }
function canvasMouseMove() { function canvasMouseMove() {
clearTimeout(pressTimer);
mouse_position = d3.touches(this)[0]||d3.mouse(this); mouse_position = d3.touches(this)[0]||d3.mouse(this);
// Prevent touch scrolling... // Prevent touch scrolling...
@ -323,7 +321,6 @@ RED.view = function() {
if (d > 2) { if (d > 2) {
mouse_mode = RED.state.MOVING_ACTIVE; mouse_mode = RED.state.MOVING_ACTIVE;
clickElapsed = 0; clickElapsed = 0;
clearTimeout(pressTimer);
} }
} else if (mouse_mode == RED.state.MOVING_ACTIVE || mouse_mode == RED.state.IMPORT_DRAGGING) { } else if (mouse_mode == RED.state.MOVING_ACTIVE || mouse_mode == RED.state.IMPORT_DRAGGING) {
var mousePos = mouse_position; var mousePos = mouse_position;
@ -369,7 +366,6 @@ RED.view = function() {
} }
function canvasMouseUp() { function canvasMouseUp() {
clearTimeout(pressTimer);
if (mousedown_node && mouse_mode == RED.state.JOINING) { if (mousedown_node && mouse_mode == RED.state.JOINING) {
drag_line.attr("class", "drag_line_hidden"); drag_line.attr("class", "drag_line_hidden");
} }
@ -725,9 +721,6 @@ RED.view = function() {
} }
function nodeMouseDown(d) { function nodeMouseDown(d) {
if (typeof d3.touches(this)[0] == "object") {
pressTimer = setTimeout(function() { RED.editor.edit(d); }, 1500);
}
if (mouse_mode == RED.state.IMPORT_DRAGGING) { if (mouse_mode == RED.state.IMPORT_DRAGGING) {
RED.keyboard.remove(/* ESCAPE */ 27); RED.keyboard.remove(/* ESCAPE */ 27);
updateSelection(); updateSelection();
@ -889,7 +882,7 @@ RED.view = function() {
//node.append("rect").attr("class", "node-gradient-bottom").attr("rx", 6).attr("ry", 6).attr("height",30).attr("stroke","none").attr("fill","url(#gradient-bottom)").style("pointer-events","none"); //node.append("rect").attr("class", "node-gradient-bottom").attr("rx", 6).attr("ry", 6).attr("height",30).attr("stroke","none").attr("fill","url(#gradient-bottom)").style("pointer-events","none");
mainRect.on("mouseup",nodeMouseUp); mainRect.on("mouseup",nodeMouseUp);
mainRect.on("touchend",function(){ clearTimeout(pressTimer); nodeMouseUp; }); mainRect.on("touchend",nodeMouseUp);
//mainRect.on("touchend",nodeMouseUp); //mainRect.on("touchend",nodeMouseUp);
if (d._def.icon) { if (d._def.icon) {
@ -1109,9 +1102,7 @@ RED.view = function() {
updateSelection(); updateSelection();
redraw(); redraw();
d3.event.stopPropagation(); d3.event.stopPropagation();
pressTimer = setTimeout(function() { deleteSelection(); }, 1500); });
})
.on("touchend",function() { clearTimeout(pressTimer); });
link.exit().remove(); link.exit().remove();