From 428462abf5c24b2f085ea48df12759378cb5ed81 Mon Sep 17 00:00:00 2001 From: Connor Turland Date: Wed, 26 Feb 2014 14:45:01 -0800 Subject: [PATCH] hope to have fixed the double click to open topic card issue --- .../Jit/graphsettings-event-handlers.js | 47 ++++++++++--------- 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/app/assets/javascripts/Jit/graphsettings-event-handlers.js b/app/assets/javascripts/Jit/graphsettings-event-handlers.js index 439594a2..6817e040 100644 --- a/app/assets/javascripts/Jit/graphsettings-event-handlers.js +++ b/app/assets/javascripts/Jit/graphsettings-event-handlers.js @@ -179,30 +179,35 @@ function nodeWasDoubleClicked() { function selectNodeOnClickHandler(node, e) { if (Mconsole.busy) return; - if (nodeWasDoubleClicked()) { + var check = nodeWasDoubleClicked(); + if (check) { nodeDoubleClickHandler(node, e); return; + } else { + // wait a certain length of time, then check again, then run this code + setTimeout(function() { + if (!nodeWasDoubleClicked()) { + if (!e.shiftKey) { + Mconsole.graph.eachNode(function (n) { + if (n.id != node.id) { + deselectNode(n); + } + }); + } + if (node.selected) { + deselectNode(node); + } else { + selectNode(node); + } + //trigger animation to final styles + Mconsole.fx.animate({ + modes: ['edge-property:lineWidth:color:alpha'], + duration: 500 + }); + Mconsole.plot(); + } + }, MetamapsModel.DOUBLE_CLICK_TOLERANCE); } - - //set final styles - if (!e.shiftKey) { - Mconsole.graph.eachNode(function (n) { - if (n.id != node.id) { - deselectNode(n); - } - }); - } - if (node.selected) { - deselectNode(node); - } else { - selectNode(node); - } - //trigger animation to final styles - Mconsole.fx.animate({ - modes: ['edge-property:lineWidth:color:alpha'], - duration: 500 - }); - Mconsole.plot(); }//selectNodeOnClickHandler function selectNodeOnRightClickHandler(node, e) {