Skip to content

- Fixed the 'handleWheelZoom' function that zoomed in incorrectly#841

Open
Nolesh wants to merge 1 commit intonamespace-ee:mainfrom
Nolesh:fix-wheel-zoom
Open

- Fixed the 'handleWheelZoom' function that zoomed in incorrectly#841
Nolesh wants to merge 1 commit intonamespace-ee:mainfrom
Nolesh:fix-wheel-zoom

Conversation

@Nolesh
Copy link

@Nolesh Nolesh commented Nov 11, 2021

This PR fixes a bug related to incorrect zoom in calculation. This error is especially noticeable when using 10x zoom (ctrl + mouse wheel)

@lnagel
Copy link
Member

lnagel commented Feb 5, 2026

@developer-ocansey — Flagging this for your review.

Recommendation: The bug still exists — apply as a quick fix to the current codebase

The bug

The wheel zoom formula in Timeline.tsx:526 is asymmetric:

this.changeZoom(1.0 + (speed * deltaY) / 500, xPosition / this.state.width)

When deltaY is positive (zoom out), a scale of e.g. 1.2 is applied. When deltaY is negative (zoom in), a scale of 0.8 is applied. But 1.2 × 0.8 = 0.96 ≠ 1.0, so zooming in and then out by the same delta does not return to the original zoom level. The drift is more noticeable at higher speeds.

The fix

This PR correctly identifies that for symmetric zoom, zooming in should use 1/k instead of 2-k. For negative delta, the formula should be 1.0 / (1.0 + speed * |deltaY| / 500).

Why it can't merge directly

The PR targets the old Timeline.js — the fix needs to be re-applied to Timeline.tsx line 526. It's a 2-3 line change.

The math is sound and this is a genuine UX improvement. I'd suggest just applying the fix directly to Timeline.tsx rather than trying to rebase this PR.

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.

3 participants