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

Fix UI scaling issues #5571

Closed
wants to merge 3 commits into from
Closed

Conversation

Weibye
Copy link
Contributor

@Weibye Weibye commented Aug 3, 2022

Objective

Fixes #3493
Adopted from and supersedes #3533

The issue was that extracted_uinode.rect is scaled according to the window's scale factor when extracted_uinode.atlas_size is None, but it's not scaled when extracted_uinode.atlas_size is Some.

Solution

I changed one condition to avoid relying on extracted_uinode.rect, extracted the window's scale factor into the render app, and applied it as necessary when calculating the clipped UVs.
To be honest, I can't properly explain why it works this way, and I'm not confident I covered all cases. In #3460, the similar fields extracted_sprite.rect and extracted_sprite.atlas_size are changed to cleanly separate what affects position/size and what affects UVs. I hope to port to UI the sprite improvements of that PR after it's accepted, but meanwhile this smaller PR can fix the issue.


Changelog

This section is optional. If this was a trivial fix, or has no externally-visible impact, you can delete this section.

  • What changed as a result of this PR?
  • If applicable, organize changes under "Added", "Changed", or "Fixed" sub-headings
  • Stick to one or two sentences. If more detail is needed for a particular change, consider adding it to the "Solution" section
    • If you can't summarize the work, your change may be unreasonably large / unrelated. Consider splitting your PR to make it easier to review and merge!

Migration Guide

This section is optional. If there are no breaking changes, you can delete this section.

  • If this PR is a breaking change (relative to the last release of Bevy), describe how a user might need to migrate their code to support these changes
  • Simply adding new functionality is not a breaking change.
  • Fixing behavior that was definitely a bug, rather than a questionable design choice is not a breaking change.

@Weibye
Copy link
Contributor Author

Weibye commented Aug 3, 2022

Closing as obsolete. The problem has already been resolved

@Weibye Weibye closed this Aug 3, 2022
@Weibye Weibye deleted the fix-ui-scaling-issues branch August 3, 2022 19:20
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.

Issue with UI clipping on scale factor greater than 1
2 participants