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

ScrollPosition scale factor fix #16617

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

ickshonpe
Copy link
Contributor

Objective

Scroll position uses physical coordinates. This means scrolling may go faster or slower depending on the scroll factor. Also the scrolled position will change when the scale factor changes.

Solution

In ui_layout_system convert max_possible_offset to logical coordinates before clamping the scroll position. Then convert the clamped scroll position to physical coordinates before propagating it to the node's children.

Testing

Look at the scroll example. On main if you change your display's scale factor the items displayed by the scrolling lists will change because ScrollPosition's displacement values don't respect scale factor. With this PR the displacement will be scaled too, and the won't move.

@ickshonpe ickshonpe added A-UI Graphical user interfaces, styles, layouts, and widgets D-Straightforward Simple bug fixes and API improvements, docs, test and examples C-Bug An unexpected or incorrect behavior S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Dec 2, 2024
@BenjaminBrienen BenjaminBrienen added S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-UI Graphical user interfaces, styles, layouts, and widgets C-Bug An unexpected or incorrect behavior D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants