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

Round UI coordinates after scaling #9784

Merged
merged 9 commits into from
Sep 18, 2023

Conversation

ickshonpe
Copy link
Contributor

Objective

Fixes #9754

Solution

Don't round UI coordinates until they've been multiplied by the inverse scale factor.

@alice-i-cecile alice-i-cecile added C-Bug An unexpected or incorrect behavior A-UI Graphical user interfaces, styles, layouts, and widgets labels Sep 12, 2023
@nicoburns
Copy link
Contributor

I think this is probably an improvement in that it brings the rounding later in the process (thus reducing float error). But it looks like this is now rounding in logical coordinates, whereas I think ideally it needs to be done in physical coordinates but after Transform has been applied. Not sure how feasible this is.

@ickshonpe
Copy link
Contributor Author

ickshonpe commented Sep 12, 2023

I think this is probably an improvement in that it brings the rounding later in the process (thus reducing float error). But it looks like this is now rounding in logical coordinates, whereas I think ideally it needs to be done in physical coordinates but after Transform has been applied. Not sure how feasible this is.

Yes this rounds the logical coords (or it's meant to). I tried a couple of approaches and this one seemed to be the most accurate. By after Transform has been applied do you mean after the GlobalTransform has been computed?

@mockersf mockersf added the S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it label Sep 12, 2023
@alice-i-cecile
Copy link
Member

@ickshonpe I'll merge this once you fix merge conflicts (I love import merge conflicts...).

@alice-i-cecile alice-i-cecile added this pull request to the merge queue Sep 18, 2023
Merged via the queue into bevyengine:main with commit 07f61a1 Sep 18, 2023
21 checks passed
rdrpenguin04 pushed a commit to rdrpenguin04/bevy that referenced this pull request Jan 9, 2024
# Objective

Fixes bevyengine#9754

## Solution

Don't round UI coordinates until they've been multiplied by the inverse
scale factor.
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 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.

Pixel gap between adjacent UI grid cells
4 participants