From a1e4e3c690b973cea63afd93050abe7c8dbb7be9 Mon Sep 17 00:00:00 2001 From: Herst Date: Wed, 24 Jul 2019 10:04:21 +0200 Subject: [PATCH] Emit end event after last zoom which had an effect #158 --- src/zoom.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/zoom.js b/src/zoom.js index 95c5e846c..898ac72ae 100644 --- a/src/zoom.js +++ b/src/zoom.js @@ -225,18 +225,18 @@ export default function() { k = Math.max(scaleExtent[0], Math.min(scaleExtent[1], t.k * Math.pow(2, wheelDelta.apply(this, arguments)))), p = mouse(this); + // If this wheel event won’t trigger a transform change, ignore it. + if (t.k === k) return; + // If the mouse is in the same location as before, reuse it. // If there were recent wheel events, reset the wheel idle timeout. - if (g.wheel) { + else if (g.wheel) { if (g.mouse[0][0] !== p[0] || g.mouse[0][1] !== p[1]) { g.mouse[1] = t.invert(g.mouse[0] = p); } clearTimeout(g.wheel); } - // If this wheel event won’t trigger a transform change, ignore it. - else if (t.k === k) return; - // Otherwise, capture the mouse point and location at the start. else { g.mouse = [p, t.invert(p)];