Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions examples/3d/color_grading.rs
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,11 @@ fn handle_button_presses(

/// Updates the state of the UI based on the current state.
fn update_ui_state(
mut buttons: Query<(&mut UiImage, &mut BorderColor, &ColorGradingOptionWidget)>,
mut buttons: Query<(
&mut BackgroundColor,
&mut BorderColor,
&ColorGradingOptionWidget,
)>,
mut button_text: Query<(&mut Text, &ColorGradingOptionWidget), Without<HelpText>>,
mut help_text: Query<&mut Text, With<HelpText>>,
cameras: Query<Ref<ColorGrading>>,
Expand All @@ -579,12 +583,12 @@ fn update_ui_state(
}

// The currently-selected option is drawn with inverted colors.
for (mut image, mut border_color, widget) in buttons.iter_mut() {
for (mut background, mut border_color, widget) in buttons.iter_mut() {
if *currently_selected_option == widget.option {
image.color = Color::WHITE;
*background = Color::WHITE.into();
*border_color = Color::BLACK.into();
} else {
image.color = Color::BLACK;
*background = Color::BLACK.into();
*border_color = Color::WHITE.into();
}
}
Expand Down
23 changes: 10 additions & 13 deletions examples/mobile/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,21 +114,18 @@ fn setup_scene(

// Test ui
commands
.spawn((
ButtonBundle {
style: Style {
justify_content: JustifyContent::Center,
align_items: AlignItems::Center,
position_type: PositionType::Absolute,
left: Val::Px(50.0),
right: Val::Px(50.0),
bottom: Val::Px(50.0),
..default()
},
.spawn(ButtonBundle {
style: Style {
justify_content: JustifyContent::Center,
align_items: AlignItems::Center,
position_type: PositionType::Absolute,
left: Val::Px(50.0),
right: Val::Px(50.0),
bottom: Val::Px(50.0),
..default()
},
BackgroundColor(Color::WHITE),
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't this ButtonBundle have a background_color: Color::WHITE.into() now? Or is the background meant to be transparent?

Copy link
Member Author

Choose a reason for hiding this comment

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

this is done by the button_handler system

))
..default()
})
.with_children(|b| {
b.spawn(
TextBundle::from_section(
Expand Down