From 92ceae911c41c4e4fa3d9b9388cb36c796ed8916 Mon Sep 17 00:00:00 2001 From: Ansis Brammanis Date: Thu, 28 Mar 2013 13:18:58 -0400 Subject: [PATCH] Fix click suppression in d3 zoom behavior This should be included in the next version of d3 --- js/lib/d3.v3.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/js/lib/d3.v3.js b/js/lib/d3.v3.js index fb3134ebb..a27ded7ce 100644 --- a/js/lib/d3.v3.js +++ b/js/lib/d3.v3.js @@ -3926,7 +3926,13 @@ d3 = function() { function mouseup() { if (moved) d3_eventCancel(); w.on("mousemove.zoom", null).on("mouseup.zoom", null); - if (moved && d3.event.target === eventTarget) w.on("click.zoom", click, true); + if (moved && d3.event.target === eventTarget) { + w.on("click.zoom", click, true); + window.setTimeout(function() { + // Remove click block if click didn't fire + w.on("click.zoom", null); + }, 0); + } } function click() { d3_eventCancel(); @@ -8167,4 +8173,4 @@ d3 = function() { return d3_time_scale(d3.scale.linear(), d3_time_scaleUTCMethods, d3_time_scaleUTCFormat); }; return d3; -}(); \ No newline at end of file +}();