Skip to content

Commit

Permalink
fix(zoom): fix zoom on latest chrome
Browse files Browse the repository at this point in the history
The latest update of chrome cause wheel zoom to not work properly,
if d3's zoom event bound to <rect> element.

Add the workaround to fix the issue.
d3/d3-zoom#231 (comment)

Ref #1992
  • Loading branch information
netil committed Mar 19, 2021
1 parent eed2f86 commit 37edc9b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/ChartInternal/interactions/zoom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,10 @@ export default {
const $$ = this;
const behaviour = type === "drag" ? $$.zoomBehaviour : $$.zoom;

// Since Chrome 89, wheel zoom not works properly
// Applying the workaround: https://github.com/d3/d3-zoom/issues/231#issuecomment-802305692
$$.$el.svg.on("wheel", () => {});

eventRects
.call(behaviour)
.on("dblclick.zoom", null);
Expand Down

0 comments on commit 37edc9b

Please sign in to comment.