Skip to content

Commit

Permalink
fix the mousedown-wheel-translate issue
Browse files Browse the repository at this point in the history
(see comment #211 (comment))
  • Loading branch information
Fil committed May 30, 2023
1 parent df77d81 commit 3afbe2a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/zoom.js
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ export default function() {

dragDisable(event.view);
nopropagation(event);
g.mouse = [p, this.__zoom.invert(p)];
g.prev = p;
interrupt(this);
g.start();

Expand All @@ -294,8 +294,10 @@ export default function() {
var dx = event.clientX - x0, dy = event.clientY - y0;
g.moved = dx * dx + dy * dy > clickDistance2;
}
var p = pointer(event, currentTarget);
g.event(event)
.zoom("mouse", constrain(translate(g.that.__zoom, g.mouse[0] = pointer(event, currentTarget), g.mouse[1]), g.extent, translateExtent));
.zoom("mouse", constrain(translate(g.that.__zoom, p, g.that.__zoom.invert(g.prev)), g.extent, translateExtent));
g.prev = p;
}

function mouseupped(event) {
Expand Down

0 comments on commit 3afbe2a

Please sign in to comment.