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

Don't show edit dialog for dblclick-drag

Closes #217
This commit is contained in:
Nick O'Leary 2014-05-05 23:28:24 +01:00
parent 14e882f250
commit 7c5baac192

View File

@ -38,7 +38,9 @@ RED.view = function() {
moving_set = [], moving_set = [],
dirty = false, dirty = false,
lasso = null, lasso = null,
pressTimer = null; pressTimer = null,
clickTime = 0,
clickElapsed = 0;
var clipboard = ""; 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]); 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) { if (d > 2) {
mouse_mode = RED.state.MOVING_ACTIVE; mouse_mode = RED.state.MOVING_ACTIVE;
clickElapsed = 0;
clearTimeout(pressTimer); 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) {
@ -692,6 +695,10 @@ RED.view = function() {
} }
function nodeMouseUp(d) { function nodeMouseUp(d) {
if (clickElapsed > 0 && clickElapsed < 300) {
RED.editor.edit(d);
return;
}
portMouseUp(d, d._def.inputs > 0 ? 1 : 0, 0); portMouseUp(d, d._def.inputs > 0 ? 1 : 0, 0);
} }
@ -709,6 +716,10 @@ RED.view = function() {
return; return;
} }
mousedown_node = d; mousedown_node = d;
var now = Date.now();
clickElapsed = now-clickTime;
clickTime = now;
if (d.selected && d3.event.ctrlKey) { if (d.selected && d3.event.ctrlKey) {
d.selected = false; d.selected = false;
for (var i=0;i<moving_set.length;i+=1) { for (var i=0;i<moving_set.length;i+=1) {
@ -841,7 +852,6 @@ RED.view = function() {
.attr("fill",function(d) { return d._def.color;}) .attr("fill",function(d) { return d._def.color;})
.on("mousedown",nodeMouseDown) .on("mousedown",nodeMouseDown)
.on("touchstart",nodeMouseDown) .on("touchstart",nodeMouseDown)
.on("dblclick",function(d) {RED.editor.edit(d);})
.on("mouseover",function(d) { .on("mouseover",function(d) {
if (mouse_mode == 0) { if (mouse_mode == 0) {
var node = d3.select(this); var node = d3.select(this);