From 7c5baac192e10b74d9ff2c2ac0c654c3204d06dd Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Mon, 5 May 2014 23:28:24 +0100 Subject: [PATCH] Don't show edit dialog for dblclick-drag Closes #217 --- public/red/ui/view.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/public/red/ui/view.js b/public/red/ui/view.js index 1f687250d..67ae059ad 100644 --- a/public/red/ui/view.js +++ b/public/red/ui/view.js @@ -38,7 +38,9 @@ RED.view = function() { moving_set = [], dirty = false, lasso = null, - pressTimer = null; + pressTimer = null, + clickTime = 0, + clickElapsed = 0; var clipboard = ""; @@ -318,6 +320,7 @@ RED.view = function() { var d = (mouse_offset[0]-m[0])*(mouse_offset[0]-m[0]) + (mouse_offset[1]-m[1])*(mouse_offset[1]-m[1]); if (d > 2) { mouse_mode = RED.state.MOVING_ACTIVE; + clickElapsed = 0; clearTimeout(pressTimer); } } else if (mouse_mode == RED.state.MOVING_ACTIVE || mouse_mode == RED.state.IMPORT_DRAGGING) { @@ -692,6 +695,10 @@ RED.view = function() { } function nodeMouseUp(d) { + if (clickElapsed > 0 && clickElapsed < 300) { + RED.editor.edit(d); + return; + } portMouseUp(d, d._def.inputs > 0 ? 1 : 0, 0); } @@ -709,6 +716,10 @@ RED.view = function() { return; } mousedown_node = d; + var now = Date.now(); + clickElapsed = now-clickTime; + clickTime = now; + if (d.selected && d3.event.ctrlKey) { d.selected = false; for (var i=0;i