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 the UV calculations for clipped and flipped ImageNodes #8195

Merged
merged 3 commits into from Apr 17, 2023

Conversation

ickshonpe
Copy link
Contributor

@ickshonpe ickshonpe commented Mar 24, 2023

Objective

Instead of flipping the entire image, prepare_ui_nodes only flips the unclipped area.

overflow_flipped_bug

Solution

Whenever flip_x or flip_y is set swap the image rect coordinates and invert the clipping coords along the flipped axes before the UVs are calculated.

overflow_fixed

--

Changelog

  • Modified prepare_uinodes so that the UVs for clipped and flipped image nodes are calculated correctly.

…tly when clipping was applied.

Instead of flipping the entire image, `prepare_ui_nodes` would only flip the clipped area.

With this change, whenever flip_x or flip_y is set the image rect coordinates are swapped and the clipping coords are inverted along the flipped axes before uvs are calculated.
@ickshonpe ickshonpe changed the title Fix UV calculations for clipped and flipped ImageNodes Fix the UV calculations for clipped and flipped ImageNodes Mar 24, 2023
@james7132 james7132 added A-UI Graphical user interfaces, styles, layouts, and widgets C-Bug An unexpected or incorrect behavior labels Mar 28, 2023
Copy link
Member

@james7132 james7132 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logic seemingly makes sense. Though this is getting a lot harder to disentangle how this all works.

@james7132 james7132 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 Mar 31, 2023
@ickshonpe
Copy link
Contributor Author

Logic seemingly makes sense. Though this is getting a lot harder to disentangle how this all works.

Yes, I feel confident this works. At worst if there are any problems they'll be obvious in the displayed output.

@alice-i-cecile alice-i-cecile added this pull request to the merge queue Apr 17, 2023
Merged via the queue into bevyengine:main with commit 43d7184 Apr 17, 2023
23 checks passed
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.

None yet

3 participants