-
Notifications
You must be signed in to change notification settings - Fork 488
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
8334874: Horizontal scroll events from touch pads should scroll the TabPane tabs #1486
Conversation
👋 Welcome back jpereda! A progress list of the required criteria for merging this PR into |
@jperedadnr This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 30 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. ➡️ To integrate this PR with the above commit message to the |
Webrevs
|
Considering that this is an improvement and a change in behavior, I would like to suggest a couple of changes:
And, a question - does this change require a CSR, since we are changing the behavior? |
Good question. Thinking out loud, if what this PR does is to change the existing behavior of top/bottom TabPane scrolling (e.g., horizontal scrollbar) to align with what ScrollPane already does, then... maybe not? (a CSR wouldn't be a bad idea, though) I'd be happy to hear others thoughts on this. It does need two reviewers. /reviewers 2 |
@kevinrushforth |
I don't recommend doing that as part of this PR. That would be a noticeable behavior change, and warrants more discussion.
Do ScrollPane or ListView work this way already? If they do, then it seems reasonable to do the same here. Otherwise, I'm not sure we should do this for TabPane in isolation. |
we are changing the behavior already by changing the direction of the gesture, so I thought we should be able to tackle this issue within the same PR. The other point is the discussion - these comments are already on the mailing list, what alternative discussion is required? And what are the acceptance criteria for that discussion? |
Good point - both have the same issue (I am sure other controls as well, TableView, others did not check). Definitely deserves a separate ticket, possibly even an umbrella task (RTL navigation). |
Side side = getSkinnable().getSide(); | ||
side = side == null ? Side.TOP : side; | ||
switch (side) { | ||
default: | ||
case TOP: | ||
case BOTTOM: | ||
setScrollOffset(scrollOffset + e.getDeltaY()); | ||
// Consider vertical scroll events (dy > dx) from mouse wheel and trackpad, | ||
// and horizontal scroll events from a trackpad (dx > dy) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should explain why - to preserve the existing behavior with the mouse (scrolling up/down)?
The trackpad events can have both dx
and dy
of various magnitude, both non-zero, so the logic seems to me a bit contrived - like filtering some events, although at the end it still feels ok.
What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(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
, soabs(dy) > abs(dx)
), then we just takedy
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 smallerdy
(that wouldn't have any effect in any case).
I'm happy to reword the comment if needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 theTabPane
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.
@jperedadnr This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am ok with fixing the direction of vertical scrolling in a separate ticket, as well as RTL reversal of the horizontal scrolling, also as a separate ticket.
Left a couple of minor comments, otherwise looks good. I'll re-approve if you decide to make changes.
assertEquals(firstTabBounds.getMinY() - deltaY, newFirstTabBounds.getMinY(), 0); | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please remove unnecessary newline
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
I ran the program attached to the bug report and it now recognizes horizontal scroll as expected. I also verified that the newly added test fails without your fix and passes with your fix.
/integrate |
Going to push as commit 1bdb93c.
Your commit was automatically rebased without conflicts. |
@jperedadnr Pushed as commit 1bdb93c. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
This PR considers the horizontal scroll events that can be generated on a trackpad, on an horizontally sided
TabPane
control (top or bottom), adding to the existing vertical scroll events from mouse wheel and trackpad, to scroll its tabs.Therefore, scrolling a
TabPane
will behave in the same way thatScrollBar
does regarding those same events and control orientation (vertical/horizontal).Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jfx.git pull/1486/head:pull/1486
$ git checkout pull/1486
Update a local copy of the PR:
$ git checkout pull/1486
$ git pull https://git.openjdk.org/jfx.git pull/1486/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 1486
View PR using the GUI difftool:
$ git pr show -t 1486
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jfx/pull/1486.diff
Webrev
Link to Webrev Comment