-
Notifications
You must be signed in to change notification settings - Fork 59
Open
Labels
A-UIGraphical user interfaces, styles, layouts, and widgetsGraphical user interfaces, styles, layouts, and widgetsC-Code-QualityA section of code that is hard to understand or changeA section of code that is hard to understand or changeX-ContentiousThere are nontrivial implications that should be thought throughThere are nontrivial implications that should be thought through
Milestone
Description
Bevy 0.17 added the observe function using a bundle effect which makes it easier to add observers to nest hierarchies.
So far the only place that could use this that I've found is
bevy_new_2d/src/theme/widget.rs
Line 110 in 9fd68f6
| Children::spawn(SpawnWith(|parent: &mut ChildSpawner| { |
Which could now be done as
(
Name::new("Button"),
Node::default(),
children![
Name::new("Button Inner"),
Button,
BackgroundColor(BUTTON_BACKGROUND),
InteractionPalette {
none: BUTTON_BACKGROUND,
hovered: BUTTON_HOVERED_BACKGROUND,
pressed: BUTTON_PRESSED_BACKGROUND,
},
button_bundle,
observe(action),
children![(
Name::new("Button Text"),
Text(text),
TextFont::from_font_size(40.0),
TextColor(BUTTON_TEXT),
// Don't bubble picking events from the text up to the button.
Pickable::IGNORE,
)],
)]
)But there may be more that I'm missing
This will require enabling the experimental_bevy_ui_widgets feature on bevy though which may not be desirable.
Metadata
Metadata
Assignees
Labels
A-UIGraphical user interfaces, styles, layouts, and widgetsGraphical user interfaces, styles, layouts, and widgetsC-Code-QualityA section of code that is hard to understand or changeA section of code that is hard to understand or changeX-ContentiousThere are nontrivial implications that should be thought throughThere are nontrivial implications that should be thought through