RFR: 8334874: Horizontal scroll events from touch pads should scroll the TabPane tabs [v4]

Jose Pereda jpereda at openjdk.org
Wed Jul 24 23:19:38 UTC 2024


On Wed, 24 Jul 2024 17:10:15 GMT, Andy Goryachev <angorya at openjdk.org> wrote:

>> (sorry I missed to reply)
>> 
>> I believe the comment already states what are we taking into account, but this is a more detailed explanation:
>> 
>> - a mouse wheel only has vertical scroll events (`dx == 0`, so `abs(dy) > abs(dx)`), then we just take `dy` to produce the horizontal scroll offset.
>> - a trackpad has both scroll events, and we take whichever is bigger. Typically the user will do a horizontal scrolling if tabs are horizontally laid out, and therefore abs(dy) <<< abs(dx), so we take `dx` to produce the horizontal scroll offset, ignoring the smaller `dy` (that wouldn't have any effect in any case).
>> 
>> I'm happy to reword the comment if needed.
>
> Thank you!
> 
> A larger question is that ideally we would need a mechanism to differentiate trackpad from mouse events, as they sometimes require different handling.  We can't fully rely on the fact that either dx or dy is exactly 0.0, since theoretically we could get those events from the trackpad.
> 
> What do you think?

In this case, the bigger value from the scrolling gesture prevails, ignoring the other small one (it doesn't matter if it is exactly 0 or not).
 
For  the`TabPane` case, that is good enough, since we only want to scroll in one direction, and it really doesn't matter if the source is a mouse wheel or a trackpad.

-------------

PR Review Comment: https://git.openjdk.org/jfx/pull/1486#discussion_r1690570921


More information about the openjfx-dev mailing list