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

Add overflow_debug example #8198

Merged
merged 5 commits into from
Apr 5, 2023
Merged

Conversation

doup
Copy link
Contributor

@doup doup commented Mar 24, 2023

Objective

  • Add a new example that helps debug different UI overflow scenarios
  • This example tests the clipping behavior for images and text when the node is moved, scaled or rotated.

Solution

  • Add a new overflow_debug example

Preview

Note: Only top-left is working properly right now.

bevy-overflow-debug.mp4

Related #8095, #8167

@doup doup changed the title WIP: Add basic overflow_debug example WIP: Add overflow_debug example Mar 24, 2023
@doup doup marked this pull request as ready for review March 24, 2023 21:57
@doup doup changed the title WIP: Add overflow_debug example Add overflow_debug example Mar 24, 2023
animation.t = (time - animation.paused_total) % LOOP_LENGTH / LOOP_LENGTH;
}
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe needs some comments here because the plan has been to move away from using the Transform hierarchy for UI nodes. Also, the layout only supports rectangular axis-aligned UI nodes so modifying the Transform on nodes with children especially can just end up in a mess. So users need to be warned against naively applying arbitrary rotations and scaling like they would with sprites and expecting it to just work.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yup, I know transform should be derived from style… but didn't find any other way to change scale/rotation. I wanted to force scale/rotation (translation it's used to update top/left) to see how it behaves.

Although, now that I think about it… maybe it doesn't make any sense to put these in the example if it's not a current feature. Or… it could be used to fix scale/rotation? Although, probably this should be done at shader/stencil/mask/whatever… level; using textures and composition and not by cutting geometry. (?)

Copy link
Contributor

Choose a reason for hiding this comment

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

I've been working on #8240 which fixes some of the problems, but I'm not too sure about the API though.
It's not necessarily a problem that the example cases don't all display correctly, we could just put a WIP label or something. Users need to be aware that the clipping is very basic.

Copy link
Contributor

@ickshonpe ickshonpe Mar 30, 2023

Choose a reason for hiding this comment

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

Actually thinking about it this will be really good to adapt to use as a test case for the UI Transform PR if you don't mind 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hey, I had a surgery a couple of days ago, I don't think I'll check the PRs anytime soon. Please fork it and do as you wish.

Copy link
Member

Choose a reason for hiding this comment

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

I think its reasonable to merge this as-is. Just make whatever changes are needed in #8240.

examples/ui/overflow_debug.rs Outdated Show resolved Hide resolved
examples/ui/overflow_debug.rs Outdated Show resolved Hide resolved
examples/ui/overflow_debug.rs Outdated Show resolved Hide resolved
@james7132 james7132 added A-UI Graphical user interfaces, styles, layouts, and widgets C-Examples An addition or correction to our examples labels Mar 28, 2023
@cart cart enabled auto-merge April 5, 2023 22:31
@cart cart added this pull request to the merge queue Apr 5, 2023
Merged via the queue into bevyengine:main with commit b8b0942 Apr 5, 2023
@doup doup deleted the overflow-debug-example branch April 6, 2023 07:40
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-Examples An addition or correction to our examples
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants