Skip to content

Fix horizontal wheel panning on the canvas - #1113

Open
yzxcj797 wants to merge 1 commit into
drawdb-io:mainfrom
yzxcj797:fix/horizontal-wheel-scroll-1108
Open

Fix horizontal wheel panning on the canvas#1113
yzxcj797 wants to merge 1 commit into
drawdb-io:mainfrom
yzxcj797:fix/horizontal-wheel-scroll-1108

Conversation

@yzxcj797

Copy link
Copy Markdown

Summary

  • Resolve canvas wheel panning through a small helper that applies both deltaX and deltaY.
  • Keep Shift+wheel working on browsers that report it as deltaY, while also supporting Chromium/macOS browsers that translate the same gesture to deltaX.
  • Support native horizontal wheels and horizontal trackpad motion without Shift.
  • Add focused regression coverage for both browser reporting conventions, horizontal/vertical/diagonal motion, and zero deltas.

Fixes #1108.

Root cause

The previous panning branch only read deltaY. Browsers do not report Shift+wheel uniformly: some preserve the vertical value in deltaY, while Chromium on macOS can translate it to deltaX with deltaY === 0. Native horizontal wheels also produce a non-zero deltaX. In those cases the old calculation added zero and the canvas appeared not to move.

Testing

  • npm test — 6/6 tests pass
  • npm run lint — passes with zero warnings
  • npm run build — passes (existing lottie-web eval and large-chunk warnings remain)
  • git diff --check — passes

I also exercised the canvas wheel path in Chromium with both Shift+wheel reporting forms, native horizontal wheel input, vertical wheel input, and Ctrl+wheel zoom; panning and zoom behavior remained correct.

Resolve wheel pan deltas through a helper that accepts both browser
reporting conventions for Shift + wheel: Chromium on macOS translates
the vertical input to deltaX while other platforms keep deltaY. Also
apply plain deltaX so native horizontal wheels and trackpads pan the
canvas instead of being ignored.

Fixes drawdb-io#1108
@vercel

vercel Bot commented Aug 18, 2026

Copy link
Copy Markdown

@yzxcj797 is attempting to deploy a commit to the dottle's projects Team on Vercel.

A member of the Team first needs to authorize it.

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.

[BUG] Mouse Wheel Horizontal Scroll not working

1 participant