summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorAlon Levy <alon@pobox.com>2014-09-28 22:10:45 +0300
committerAlon Levy <alon@pobox.com>2014-09-28 22:10:45 +0300
commit3c210c83116c5a4a646bbf274e2b9219dbf9de80 (patch)
treec2285ff2701661d24cf185004b225afdbb134e37 /scripts
parent39f13e5e9b66fc1aaae6db6c922f6434681cc056 (diff)
rhizicore: prevent click event when dragging a node
Diffstat (limited to 'scripts')
-rw-r--r--scripts/rhizicore.js8
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);