Skip to content

Fix precision touchpad scroll direction on charts - #2866

Open
GGn0 wants to merge 1 commit into
bardsoftware:masterfrom
GGn0:tkt-2865-handlePreciseScrollEvents
Open

GGn0 wants to merge 1 commit into
bardsoftware:masterfrom
GGn0:tkt-2865-handlePreciseScrollEvents

Conversation

@GGn0

@GGn0 GGn0 commented Oct 30, 2026

Copy link
Copy Markdown

Fixes #2865

Problem
On precision touchpads, MouseWheelEvent.getWheelRotation() is always 0 and the movement is only reported through getPreciseWheelRotation(). The direction checks use getWheelRotation() < 0, which is never true for these events, so every swipe is treated as a down/right scroll.

Change
In MouseWheelListenerBase.java and ScrollViewInteraction.java:

  • Direction test: getWheelRotation() < 0 → getPreciseWheelRotation() < 0
  • Zero check: getWheelRotation() == 0 → getPreciseWheelRotation() == 0.0, for consistency. Touchpad events don't reach this check today, so it isn't needed for the fix and I'm happy to drop it.

The scroll amount logic is unchanged. A classic mouse wheel reports whole numbers in both methods, so its behaviour is the same as before.

Testing
Built from master and tested on Windows 11 with an HP ZBook Power G10 precision touchpad:

  • Two-finger scroll up/down and left/right: all four directions now work
  • Shift+scroll horizontal scrolling
  • Ctrl+scroll zoom
  • Classic mouse wheel: unchanged

Also tested on an older laptop with a non-precision touchpad: scrolling worked before the change and still works after it.

Not tested: macOS and Linux touchpads. Feedback from anyone with that hardware is welcome.

Use getPreciseWheelRotation
@GGn0 GGn0 changed the title Handle newer mousepad scroll events Fix precision touchpad scroll direction on charts Oct 30, 2026
@dbarashev

Copy link
Copy Markdown
Contributor

Do you have any idea if it is possible that on some hardware getPreciseWheelRotation return 0 while the non-precise method returns something different from 0?

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.

Precision touchpad: up/left scrolling is treated as down/right on charts

2 participants