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

[bevy_ui/layout] Handle ui heirchy change edge cases #13360

Draft
wants to merge 47 commits into
base: main
Choose a base branch
from

Conversation

StrikeForceZero
Copy link
Contributor

@StrikeForceZero StrikeForceZero commented May 13, 2024

  • I need to open an issue that documents the problem this is solving

Blocked on:


Objective

  • Handle UI Nodes being moved to a new parent Changed<Parent>
  • Handle UI Nodes who lost their parent RemovedComponent<Parent>

Solution

  • Adds query to the layout_system to handle the specified edge cases

Testing

  • Did you test these changes? If so, how?
    • Added Tests
  • Are there any parts that need more testing?
    • Identifying any potential regressions or unknown side effects
  • How can other people (reviewers) test your changes? Is there anything specific they need to know?
    • Testing an example project that emulates a drag-and-drop-like behavior for UI node relationships.
    • Think of alternative edge cases that fit with the scope of this PR.
  • If relevant, what platforms did you test these changes on, and are there any important ones you can't test?
    • Tested on Linux

Changelog

  • Added handling of UI nodes changing parents
  • Added handling of UI nodes removing parents

@@ -158,6 +160,82 @@ pub fn ui_layout_system(
}
}

for new_root_node_entity in removed_parents.read() {
// TODO: most of this should be moved into a function on `UiSurface` but the query requirements might feel out of place
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was planning on moving this logic into an associated function on UiSurface, especially with #13359, but passing the queries seems out of scope. I am open to suggestions.

@StrikeForceZero StrikeForceZero force-pushed the dev/bevy_ui/ui_surface_promo_demo branch from 65fb529 to 03fb1fa Compare May 13, 2024 22:42
@alice-i-cecile alice-i-cecile added C-Bug An unexpected or incorrect behavior A-UI Graphical user interfaces, styles, layouts, and widgets S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged labels May 15, 2024
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-Waiting-on-Author The author needs to make changes or address concerns before this can be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants