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

Only trigger dbl click on single node

Fixes #301
This commit is contained in:
Nick O'Leary 2014-07-27 22:08:27 +01:00
parent 76a6730ef4
commit 536a0c9142

View File

@ -46,6 +46,8 @@ RED.view = function() {
dirty = false, dirty = false,
lasso = null, lasso = null,
showStatus = false, showStatus = false,
lastClickNode = null,
dblClickPrimed = null,
clickTime = 0, clickTime = 0,
clickElapsed = 0; clickElapsed = 0;
@ -824,7 +826,7 @@ RED.view = function() {
} }
function nodeMouseUp(d) { function nodeMouseUp(d) {
if (mousedown_node == d && clickElapsed > 0 && clickElapsed < 750) { if (dblClickPrimed && mousedown_node == d && clickElapsed > 0 && clickElapsed < 750) {
RED.editor.edit(d); RED.editor.edit(d);
clickElapsed = 0; clickElapsed = 0;
d3.event.stopPropagation(); d3.event.stopPropagation();
@ -851,6 +853,9 @@ RED.view = function() {
clickElapsed = now-clickTime; clickElapsed = now-clickTime;
clickTime = now; clickTime = now;
dblClickPrimed = (lastClickNode == mousedown_node);
lastClickNode = mousedown_node;
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) {