Skip to content

fix(timeline): unify and clamp cross-platform wheel zoom#866

Open
lukecotter wants to merge 1 commit into
certinia:mainfrom
lukecotter:bug-timeline-wheel-zoom
Open

fix(timeline): unify and clamp cross-platform wheel zoom#866
lukecotter wants to merge 1 commit into
certinia:mainfrom
lukecotter:bug-timeline-wheel-zoom

Conversation

@lukecotter

Copy link
Copy Markdown
Collaborator

📝 PR Overview

Makes timeline mouse-wheel zoom consistent across platforms and input devices. Follow-up to the #863 investigation, where Windows wheel zoom felt jumpy compared with macOS.

🛠️ Changes made

  • Extract one wheelZoomFactor() helper in ViewportUtilsclamped per-event delta (so a Windows mouse notch and a macOS trackpad map to the same bounded step) and an exponential factor (always > 0; zoom-in then zoom-out is reciprocal, so no drift).
  • Replace the duplicated 1 + -deltaY * 0.001 formula in all three wheel handlers (main flame chart, minimap, metric strip) with the shared helper.

This also fixes two latent defects in the old linear formula: a large single delta could produce a <= 0 zoom factor, and repeated in/out scrolling drifted away from the starting zoom.

🧩 Type of change (check all applicable)

  • 🐛 Bug fix - something not working as expected
  • ♻️ Refactor - internal changes with no user impact

🔗 Related Issues

related #863

✅ Tests added?

  • 👍 yes — ViewportUtils.test.ts (helper math: direction, positivity, symmetry, clamp, deltaMode, sensitivity) and TimelineInteractionHandler.test.ts (wheel/mouse wiring).

📚 Docs updated?

  • 🔖 CHANGELOG.md

The three timeline wheel handlers each used an unbounded linear factor (1 + -deltaY*0.001), which zoomed in large jumps on Windows mice, could go <=0 on fast scrolls, and drifted (in-then-out did not return to the same zoom). Extract one wheelZoomFactor() helper (clamped, exponential) in ViewportUtils and share it across the main, minimap and metric-strip handlers.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant