Skip to content
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

Only allow scrolling of a scroll pane if it has scroll focus #7358

Merged

Conversation

raeleus
Copy link
Contributor

@raeleus raeleus commented Mar 4, 2024

This PR addresses the issue of a user using the scrollwheel inside a ScrollPane nested inside of another ScrollPane causing both to scroll at the same time. If you look at web browsers and other user interfaces, scrolling a nested scroll pane never scrolls the parent at the same time. Advanced layouts with lots of scrollable content will benefit from this.

@NathanSweet
Copy link
Member

I agree the currently scrolling behavior isn't good, only the inner scrollpane should scroll when it has focus.

Normally only the scroll focus actor gets the scroll event. When scrollpanes are nested, the event bubbles up to the parent and it reacts too. Your fix is fine, or it could be fixed using event.cancel(); so the event doesn't reach the parent. The difference is minimal but I think I prefer that, so the logic is done with the event system and doesn't need to check external state.

@NathanSweet NathanSweet merged commit 3a9a2fe into libgdx:master Apr 13, 2024
2 checks passed
@raeleus
Copy link
Contributor Author

raeleus commented Apr 13, 2024

Thank you so much!

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.

None yet

2 participants