Permalink
Browse files

check for defaultPrevented to disable clicks when a drag is happening

  • Loading branch information...
1 parent 65386ff commit 1b819a1e6943aa61e392f787090bdb4ead400c8a @Trott committed Jul 20, 2014
Showing with 7 additions and 1 deletion.
  1. +7 −1 js/main.js
View
@@ -101,7 +101,10 @@ d3.json('data/' + id + '.json', function (error, links) {
.enter().append("circle")
.attr("r", 64)
.attr("class", "node")
- .on("click", function (datum,index) {
+ .on("click", function (datum, index) {
+ if (d3.event.defaultPrevented) {
+ return;
+ }
var transform = d3.transform(d3.select(this).attr("transform")).translate;
var width = 320;
var height = 320;
@@ -122,6 +125,9 @@ d3.json('data/' + id + '.json', function (error, links) {
.attr("dy", y + 32)
.text("")
.on("click", function () {
+ if (d3.event.defaultPrevented) {
+ return;
+ }
container.remove();
details.remove();
name.remove();

0 comments on commit 1b819a1

Please sign in to comment.