diff options
| author | Alon Levy <alon@pobox.com> | 2014-09-28 22:10:45 +0300 |
|---|---|---|
| committer | Alon Levy <alon@pobox.com> | 2014-09-28 22:10:45 +0300 |
| commit | 3c210c83116c5a4a646bbf274e2b9219dbf9de80 (patch) | |
| tree | c2285ff2701661d24cf185004b225afdbb134e37 | |
| parent | 39f13e5e9b66fc1aaae6db6c922f6434681cc056 (diff) | |
rhizicore: prevent click event when dragging a node
| -rw-r--r-- | scripts/rhizicore.js | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/scripts/rhizicore.js b/scripts/rhizicore.js index 059de98c..4936b8cd 100644 --- a/scripts/rhizicore.js +++ b/scripts/rhizicore.js @@ -570,6 +570,10 @@ function myGraph(el) { var nodeEnter = node.enter() .append("g").attr('class', 'node') .on("click", function(d, i) { + if (d3.event.defaultPrevented) { + // drag happened, ignore click https://github.com/mbostock/d3/wiki/Drag-Behavior#on + return; + } if(d.state!=="temp"){ editNode(d, i); showInfo(d, i); @@ -622,6 +626,10 @@ function myGraph(el) { else return "0 0 0px #FFFF8F"; }) .on("click", function(d, i) { + if (d3.event.defaultPrevented) { + // drag happened, ignore click https://github.com/mbostock/d3/wiki/Drag-Behavior#on + return; + } d3.event.stopPropagation(); if(d.state!=="temp") { showInfo(d, i); |
