Repository navigation
Conversation
A touchpad sends wheel events faster than a large chart can update. Every event updated the chart synchronously, so the events queued up behind the updates and the chart fell further behind the gesture. The first event still zooms right away. The events that follow before the next animation frame are added up and applied together in that frame, and the same goes for each frame after it while events keep coming. The result is where zooming for each event would have ended. Specs and image fixtures that look at the chart after each of several wheel events now give each event its own frame.
Without a global requestAnimationFrame, as in a DOM emulation that does not pretend to be visual, the first wheel event threw after zooming. Each event now zooms at once there, as it did before events were applied per frame. The specs also cover turning the wheel off while events are waiting, and the documentation says which position a combined zoom uses.
kurkle
marked this pull request as ready for review
November 21, 2026 20:42
etimberg
approved these changes
Nov 21, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A touchpad sends wheel events faster than a large chart can update. Every event updated the chart synchronously, so the events queued up behind the updates and the chart fell further and further behind the gesture.
What changes
aleaves2 - aof the range), so the chart ends up where zooming for each event would have taken it. The focal point is that of the latest event.onZoomStartandonZoomRejectedare still called for every event, andonZoomCompleteis debounced as before.onZoomis called once per zoom, so at most once per frame after the first event.Visible to tests
Code that dispatches several wheel events in a row and expects each to have zoomed by the next line now sees only the first until a frame has passed. One spec and two image fixtures here did that; they give each event its own frame, and the reference images are unchanged.
On a category scale every zoom moves at least one category, so several small events in one frame now move one category where they used to move one each.
Fixes #1006