fix: compute axis drag zoom from local coordinates - #847
Open
NemeZZiZZ wants to merge 1 commit into
Open
Conversation
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.
Problem
Axis drag-zoom computes its scale from absolute page coordinates while every other gesture in
Event.tsuses widget-localevent.x/event.y:Consequences:
0doubles as the "not set" sentinel (!== 0), so a drag starting at page coordinate 0 — a full-width chart flush against the left/top edge of the page — silently disables axis zoom entirely.Fix
event.x/event.y(already what_xAxisStartScaleCoordinatestores on the previous line).0sentinel withnull(Nullable<number>), matching_xAxisStartScaleCoordinate.start === 0, ratio meaningless) and the pointer reaching the widget's first pixel mid-drag (event.x/y === 0→ division by zero / zero scale factor). Both now skip that event instead of producingInfinityor collapsing the range to a point.The hyperbolic response curve (
start/current) is intentionally unchanged — this PR removes the external position/scroll dependency, it does not redesign the gesture feel.