Skip to content

Commit c8d8ea6

Browse files
authored
Fix border color in ui_texture_slice and ui_texture_atlas_slice examples. (#14121)
# Objective Fixes #14120 `ui_texture_slice` and `ui_texture_atlas_slice` were working as intended, so undo the changes. ## Solution Partially revert #14115 for `ui_texture_slice` and `ui_texture_atlas_slice`. ## Testing Ran those two examples, confirmed the border color is the thing that changes when buttons are hovered.
1 parent 2893fc3 commit c8d8ea6

File tree

2 files changed

+10
-15
lines changed

2 files changed

+10
-15
lines changed

examples/ui/ui_texture_atlas_slice.rs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,31 +19,26 @@ fn main() {
1919

2020
fn button_system(
2121
mut interaction_query: Query<
22-
(
23-
&Interaction,
24-
&mut TextureAtlas,
25-
&Children,
26-
&mut BackgroundColor,
27-
),
22+
(&Interaction, &mut TextureAtlas, &Children, &mut UiImage),
2823
(Changed<Interaction>, With<Button>),
2924
>,
3025
mut text_query: Query<&mut Text>,
3126
) {
32-
for (interaction, mut atlas, children, mut color) in &mut interaction_query {
27+
for (interaction, mut atlas, children, mut image) in &mut interaction_query {
3328
let mut text = text_query.get_mut(children[0]).unwrap();
3429
match *interaction {
3530
Interaction::Pressed => {
3631
text.sections[0].value = "Press".to_string();
3732
atlas.index = (atlas.index + 1) % 30;
38-
*color = GOLD.into();
33+
image.color = GOLD.into();
3934
}
4035
Interaction::Hovered => {
4136
text.sections[0].value = "Hover".to_string();
42-
*color = ORANGE.into();
37+
image.color = ORANGE.into();
4338
}
4439
Interaction::None => {
4540
text.sections[0].value = "Button".to_string();
46-
*color = Color::BLACK.into();
41+
image.color = Color::WHITE;
4742
}
4843
}
4944
}

examples/ui/ui_texture_slice.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,25 +19,25 @@ fn main() {
1919

2020
fn button_system(
2121
mut interaction_query: Query<
22-
(&Interaction, &Children, &mut BackgroundColor),
22+
(&Interaction, &Children, &mut UiImage),
2323
(Changed<Interaction>, With<Button>),
2424
>,
2525
mut text_query: Query<&mut Text>,
2626
) {
27-
for (interaction, children, mut color) in &mut interaction_query {
27+
for (interaction, children, mut image) in &mut interaction_query {
2828
let mut text = text_query.get_mut(children[0]).unwrap();
2929
match *interaction {
3030
Interaction::Pressed => {
3131
text.sections[0].value = "Press".to_string();
32-
*color = GOLD.into();
32+
image.color = GOLD.into();
3333
}
3434
Interaction::Hovered => {
3535
text.sections[0].value = "Hover".to_string();
36-
*color = ORANGE.into();
36+
image.color = ORANGE.into();
3737
}
3838
Interaction::None => {
3939
text.sections[0].value = "Button".to_string();
40-
*color = Color::BLACK.into();
40+
image.color = Color::WHITE;
4141
}
4242
}
4343
}

0 commit comments

Comments
 (0)