[Merged by Bors] - Change UI coordinate system to have origin at top left corner#6000
[Merged by Bors] - Change UI coordinate system to have origin at top left corner#6000mahulst wants to merge 13 commits intobevyengine:mainfrom
Conversation
tim-blackbird
left a comment
There was a problem hiding this comment.
In the examples, FlexDirection::ColumnReverse should be replaced with FlexDirection::Column :)
4ca9759 to
ba1318e
Compare
ba1318e to
8429b6d
Compare
a4f1c72 to
9aa2503
Compare
|
I think the PR is ready to go now. All examples working as they should. |
|
@inodentry @Weibye @TimJentzsch can you review this over the weekend? I'd very much like to merge this on Monday before any other UI PRs. |
Weibye
left a comment
There was a problem hiding this comment.
To the best of my ability this looks good. Great work on this!
TimJentzsch
left a comment
There was a problem hiding this comment.
Thanks a lot for working on this, this will make Bevy UI a lot less confusing!
I left a few comments regarding the AlignSelf::FlexStart. The default value is AlignSelf::Auto, but it might visually the same.
I'd suggest that we try to remove the explicitly set values and see if it still looks similar, if yes I'd be in favor of removing them to make the examples a bit shorter.
|
In the changelog / migration guide I would suggest to clearly specify that the UI coordinate system was bottom left origin, y+ up and got changed to top left origin, y+ down; to avoid confusion :) |
|
@TimJentzsch Changelog was updated, and I removed the redundant styles where it made no changes. |
Argh! I'll look at this in the morning. |
|
"suggested changes" is just one of the 3 "status" options you can choose when leaving a PR review. It doesn't refer to anything specific. When you review a PR, it asks you to select what "kind" your review is: just leaving comments, an endorsement/approval, or wanting changes. It's just to help communicate how the reviewer feels about your PR. |
Ah right 🤦 I was expecting a code suggestion or something. @alice-i-cecile example has been updated! Does this need to be merged by cart? |
|
Nope, I can merge this :) It would be controversial, but @cart gave his blessing in the linked issue. The actual implementation isn't the tricky part, so this has already passed through the critical review step. |
alice-i-cecile
left a comment
There was a problem hiding this comment.
I've tested the examples again, and they're all working for me.
bors r+
# Objective Fixes #5572 ## Solution Approach is to invert the Y-axis of the UI Camera by changing the UI projection matrix to render the UI upside down. After that I'm trying to fix all issues, that pop up: - interaction expected the "old" position - images and text were displayed upside-down - baseline of text was based on the top of the glyph instead of bottom ... probably a lot more. --- Result when running examples: <details> <summary>Button example</summary> main branch:  this pr:  </details> <details> <summary>Text example</summary> m  ain branch: this pr:  </details> <details> <summary>Text debug example</summary> main branch:  this pr:  </details> <details> <summary>Transparency UI example</summary> main branch:  this pr:  </details> <details> <summary>UI example</summary> **ui example** main branch:  this pr:  </details> ## Changelog UI coordinate system and cursor position was changed from bottom left origin, y+ up to top left origin, y+ down. ## Migration Guide All flex layout should be inverted (ColumnReverse => Column, FlexStart => FlexEnd, WrapReverse => Wrap) System where dealing with cursor position should be changed to account for cursor position being based on the top left instead of bottom left
|
Pull request successfully merged into main. Build succeeded: |
…gine#6000) # Objective Fixes bevyengine#5572 ## Solution Approach is to invert the Y-axis of the UI Camera by changing the UI projection matrix to render the UI upside down. After that I'm trying to fix all issues, that pop up: - interaction expected the "old" position - images and text were displayed upside-down - baseline of text was based on the top of the glyph instead of bottom ... probably a lot more. --- Result when running examples: <details> <summary>Button example</summary> main branch:  this pr:  </details> <details> <summary>Text example</summary> m  ain branch: this pr:  </details> <details> <summary>Text debug example</summary> main branch:  this pr:  </details> <details> <summary>Transparency UI example</summary> main branch:  this pr:  </details> <details> <summary>UI example</summary> **ui example** main branch:  this pr:  </details> ## Changelog UI coordinate system and cursor position was changed from bottom left origin, y+ up to top left origin, y+ down. ## Migration Guide All flex layout should be inverted (ColumnReverse => Column, FlexStart => FlexEnd, WrapReverse => Wrap) System where dealing with cursor position should be changed to account for cursor position being based on the top left instead of bottom left
# Objective - Clipping (visible in the UI example with text scrolling) is funky - Fixes #6287 ## Solution - Fix UV calculation: - correct order for values (issue introduced in #6000) - add the `y` values instead of subtracting them now that vertical order is reversed - take scale factor into account (bug already present before reversing the order) - While around clipping, I changed clip to only mutate when changed No more funkiness! 😞 <img width="696" alt="Screenshot 2022-10-23 at 22 44 18" src="https://user-images.githubusercontent.com/8672791/197417721-30ad4150-5264-427f-ac82-e5265c1fb3a9.png">
…gine#6000) # Objective Fixes bevyengine#5572 ## Solution Approach is to invert the Y-axis of the UI Camera by changing the UI projection matrix to render the UI upside down. After that I'm trying to fix all issues, that pop up: - interaction expected the "old" position - images and text were displayed upside-down - baseline of text was based on the top of the glyph instead of bottom ... probably a lot more. --- Result when running examples: <details> <summary>Button example</summary> main branch:  this pr:  </details> <details> <summary>Text example</summary> m  ain branch: this pr:  </details> <details> <summary>Text debug example</summary> main branch:  this pr:  </details> <details> <summary>Transparency UI example</summary> main branch:  this pr:  </details> <details> <summary>UI example</summary> **ui example** main branch:  this pr:  </details> ## Changelog UI coordinate system and cursor position was changed from bottom left origin, y+ up to top left origin, y+ down. ## Migration Guide All flex layout should be inverted (ColumnReverse => Column, FlexStart => FlexEnd, WrapReverse => Wrap) System where dealing with cursor position should be changed to account for cursor position being based on the top left instead of bottom left
# Objective - Clipping (visible in the UI example with text scrolling) is funky - Fixes bevyengine#6287 ## Solution - Fix UV calculation: - correct order for values (issue introduced in bevyengine#6000) - add the `y` values instead of subtracting them now that vertical order is reversed - take scale factor into account (bug already present before reversing the order) - While around clipping, I changed clip to only mutate when changed No more funkiness! 😞 <img width="696" alt="Screenshot 2022-10-23 at 22 44 18" src="https://user-images.githubusercontent.com/8672791/197417721-30ad4150-5264-427f-ac82-e5265c1fb3a9.png">
…gine#6000) # Objective Fixes bevyengine#5572 ## Solution Approach is to invert the Y-axis of the UI Camera by changing the UI projection matrix to render the UI upside down. After that I'm trying to fix all issues, that pop up: - interaction expected the "old" position - images and text were displayed upside-down - baseline of text was based on the top of the glyph instead of bottom ... probably a lot more. --- Result when running examples: <details> <summary>Button example</summary> main branch:  this pr:  </details> <details> <summary>Text example</summary> m  ain branch: this pr:  </details> <details> <summary>Text debug example</summary> main branch:  this pr:  </details> <details> <summary>Transparency UI example</summary> main branch:  this pr:  </details> <details> <summary>UI example</summary> **ui example** main branch:  this pr:  </details> ## Changelog UI coordinate system and cursor position was changed from bottom left origin, y+ up to top left origin, y+ down. ## Migration Guide All flex layout should be inverted (ColumnReverse => Column, FlexStart => FlexEnd, WrapReverse => Wrap) System where dealing with cursor position should be changed to account for cursor position being based on the top left instead of bottom left
# Objective - Clipping (visible in the UI example with text scrolling) is funky - Fixes bevyengine#6287 ## Solution - Fix UV calculation: - correct order for values (issue introduced in bevyengine#6000) - add the `y` values instead of subtracting them now that vertical order is reversed - take scale factor into account (bug already present before reversing the order) - While around clipping, I changed clip to only mutate when changed No more funkiness! 😞 <img width="696" alt="Screenshot 2022-10-23 at 22 44 18" src="https://user-images.githubusercontent.com/8672791/197417721-30ad4150-5264-427f-ac82-e5265c1fb3a9.png">
…gine#6000) # Objective Fixes bevyengine#5572 ## Solution Approach is to invert the Y-axis of the UI Camera by changing the UI projection matrix to render the UI upside down. After that I'm trying to fix all issues, that pop up: - interaction expected the "old" position - images and text were displayed upside-down - baseline of text was based on the top of the glyph instead of bottom ... probably a lot more. --- Result when running examples: <details> <summary>Button example</summary> main branch:  this pr:  </details> <details> <summary>Text example</summary> m  ain branch: this pr:  </details> <details> <summary>Text debug example</summary> main branch:  this pr:  </details> <details> <summary>Transparency UI example</summary> main branch:  this pr:  </details> <details> <summary>UI example</summary> **ui example** main branch:  this pr:  </details> ## Changelog UI coordinate system and cursor position was changed from bottom left origin, y+ up to top left origin, y+ down. ## Migration Guide All flex layout should be inverted (ColumnReverse => Column, FlexStart => FlexEnd, WrapReverse => Wrap) System where dealing with cursor position should be changed to account for cursor position being based on the top left instead of bottom left
# Objective - Clipping (visible in the UI example with text scrolling) is funky - Fixes bevyengine#6287 ## Solution - Fix UV calculation: - correct order for values (issue introduced in bevyengine#6000) - add the `y` values instead of subtracting them now that vertical order is reversed - take scale factor into account (bug already present before reversing the order) - While around clipping, I changed clip to only mutate when changed No more funkiness! 😞 <img width="696" alt="Screenshot 2022-10-23 at 22 44 18" src="https://user-images.githubusercontent.com/8672791/197417721-30ad4150-5264-427f-ac82-e5265c1fb3a9.png">
Objective
Fixes #5572
Solution
Approach is to invert the Y-axis of the UI Camera by changing the UI projection matrix to render the UI upside down.
After that I'm trying to fix all issues, that pop up:
... probably a lot more.
Result when running examples:
Button example
main branch:


this pr:
Text example
m

ain branch:
this pr:

Text debug example
main branch:

this pr:

Transparency UI example
main branch:

this pr:

UI example
ui example

main branch:
this pr:

Changelog
UI coordinate system and cursor position was changed from bottom left origin, y+ up to top left origin, y+ down.
Migration Guide
All flex layout should be inverted (ColumnReverse => Column, FlexStart => FlexEnd, WrapReverse => Wrap)
System where dealing with cursor position should be changed to account for cursor position being based on the top left instead of bottom left