Skip to content

bevy_ui: Fix scaling issues#3533

Closed
Davier wants to merge 2 commits intobevyengine:mainfrom
Davier:fix_ui_clipping_with_scaling
Closed

bevy_ui: Fix scaling issues#3533
Davier wants to merge 2 commits intobevyengine:mainfrom
Davier:fix_ui_clipping_with_scaling

Conversation

@Davier
Copy link
Contributor

@Davier Davier commented Jan 2, 2022

Objective

Fixes #3493.
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.

@github-actions github-actions bot added the S-Needs-Triage This issue needs to be labelled label Jan 2, 2022
@alice-i-cecile alice-i-cecile added A-Rendering Drawing game state to the screen A-UI Graphical user interfaces, styles, layouts, and widgets C-Bug An unexpected or incorrect behavior and removed S-Needs-Triage This issue needs to be labelled labels Jan 2, 2022
@alice-i-cecile alice-i-cecile added S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it S-Adopt-Me The original PR author has no intent to complete this work. Pick me up! labels Jul 27, 2022
@alice-i-cecile
Copy link
Member

This PR needs to have its merge conflicts resolved. @Davier if you have time please feel free (but I know you've been busy). Otherwise I've added the Adopt-Me label; others are free to remake this PR to fix those.

@Weibye
Copy link
Contributor

Weibye commented Aug 3, 2022

The issue has already been fixed by #3854, closing this

@Weibye Weibye closed this Aug 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Rendering Drawing game state to the screen A-UI Graphical user interfaces, styles, layouts, and widgets C-Bug An unexpected or incorrect behavior S-Adopt-Me The original PR author has no intent to complete this work. Pick me up! 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.

Issue with UI clipping on scale factor greater than 1

5 participants