Skip to content

Commit e65e4be

Browse files
committed
fix examples color_grading and mobile after BackgroundColor changes (#14033)
# Objective - #14017 changed how `UiImage` and `BackgroundColor` work - one change was missed in example `color_grading`, another in the mobile example ## Solution - Change it in the examples
1 parent 27aa9d2 commit e65e4be

File tree

2 files changed

+18
-17
lines changed

2 files changed

+18
-17
lines changed

examples/3d/color_grading.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,11 @@ fn handle_button_presses(
567567

568568
/// Updates the state of the UI based on the current state.
569569
fn update_ui_state(
570-
mut buttons: Query<(&mut UiImage, &mut BorderColor, &ColorGradingOptionWidget)>,
570+
mut buttons: Query<(
571+
&mut BackgroundColor,
572+
&mut BorderColor,
573+
&ColorGradingOptionWidget,
574+
)>,
571575
mut button_text: Query<(&mut Text, &ColorGradingOptionWidget), Without<HelpText>>,
572576
mut help_text: Query<&mut Text, With<HelpText>>,
573577
cameras: Query<Ref<ColorGrading>>,
@@ -579,12 +583,12 @@ fn update_ui_state(
579583
}
580584

581585
// The currently-selected option is drawn with inverted colors.
582-
for (mut image, mut border_color, widget) in buttons.iter_mut() {
586+
for (mut background, mut border_color, widget) in buttons.iter_mut() {
583587
if *currently_selected_option == widget.option {
584-
image.color = Color::WHITE;
588+
*background = Color::WHITE.into();
585589
*border_color = Color::BLACK.into();
586590
} else {
587-
image.color = Color::BLACK;
591+
*background = Color::BLACK.into();
588592
*border_color = Color::WHITE.into();
589593
}
590594
}

examples/mobile/src/lib.rs

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -114,21 +114,18 @@ fn setup_scene(
114114

115115
// Test ui
116116
commands
117-
.spawn((
118-
ButtonBundle {
119-
style: Style {
120-
justify_content: JustifyContent::Center,
121-
align_items: AlignItems::Center,
122-
position_type: PositionType::Absolute,
123-
left: Val::Px(50.0),
124-
right: Val::Px(50.0),
125-
bottom: Val::Px(50.0),
126-
..default()
127-
},
117+
.spawn(ButtonBundle {
118+
style: Style {
119+
justify_content: JustifyContent::Center,
120+
align_items: AlignItems::Center,
121+
position_type: PositionType::Absolute,
122+
left: Val::Px(50.0),
123+
right: Val::Px(50.0),
124+
bottom: Val::Px(50.0),
128125
..default()
129126
},
130-
BackgroundColor(Color::WHITE),
131-
))
127+
..default()
128+
})
132129
.with_children(|b| {
133130
b.spawn(
134131
TextBundle::from_section(

0 commit comments

Comments
 (0)