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 https://github.com/bevyengine/bevy/pull/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.
This commit is contained in:
parent
ff070da7e2
commit
201dd62a74
@ -19,31 +19,26 @@ fn main() {
|
|||||||
|
|
||||||
fn button_system(
|
fn button_system(
|
||||||
mut interaction_query: Query<
|
mut interaction_query: Query<
|
||||||
(
|
(&Interaction, &mut TextureAtlas, &Children, &mut UiImage),
|
||||||
&Interaction,
|
|
||||||
&mut TextureAtlas,
|
|
||||||
&Children,
|
|
||||||
&mut BackgroundColor,
|
|
||||||
),
|
|
||||||
(Changed<Interaction>, With<Button>),
|
(Changed<Interaction>, With<Button>),
|
||||||
>,
|
>,
|
||||||
mut text_query: Query<&mut Text>,
|
mut text_query: Query<&mut Text>,
|
||||||
) {
|
) {
|
||||||
for (interaction, mut atlas, children, mut color) in &mut interaction_query {
|
for (interaction, mut atlas, children, mut image) in &mut interaction_query {
|
||||||
let mut text = text_query.get_mut(children[0]).unwrap();
|
let mut text = text_query.get_mut(children[0]).unwrap();
|
||||||
match *interaction {
|
match *interaction {
|
||||||
Interaction::Pressed => {
|
Interaction::Pressed => {
|
||||||
text.sections[0].value = "Press".to_string();
|
text.sections[0].value = "Press".to_string();
|
||||||
atlas.index = (atlas.index + 1) % 30;
|
atlas.index = (atlas.index + 1) % 30;
|
||||||
*color = GOLD.into();
|
image.color = GOLD.into();
|
||||||
}
|
}
|
||||||
Interaction::Hovered => {
|
Interaction::Hovered => {
|
||||||
text.sections[0].value = "Hover".to_string();
|
text.sections[0].value = "Hover".to_string();
|
||||||
*color = ORANGE.into();
|
image.color = ORANGE.into();
|
||||||
}
|
}
|
||||||
Interaction::None => {
|
Interaction::None => {
|
||||||
text.sections[0].value = "Button".to_string();
|
text.sections[0].value = "Button".to_string();
|
||||||
*color = Color::BLACK.into();
|
image.color = Color::WHITE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,25 +19,25 @@ fn main() {
|
|||||||
|
|
||||||
fn button_system(
|
fn button_system(
|
||||||
mut interaction_query: Query<
|
mut interaction_query: Query<
|
||||||
(&Interaction, &Children, &mut BackgroundColor),
|
(&Interaction, &Children, &mut UiImage),
|
||||||
(Changed<Interaction>, With<Button>),
|
(Changed<Interaction>, With<Button>),
|
||||||
>,
|
>,
|
||||||
mut text_query: Query<&mut Text>,
|
mut text_query: Query<&mut Text>,
|
||||||
) {
|
) {
|
||||||
for (interaction, children, mut color) in &mut interaction_query {
|
for (interaction, children, mut image) in &mut interaction_query {
|
||||||
let mut text = text_query.get_mut(children[0]).unwrap();
|
let mut text = text_query.get_mut(children[0]).unwrap();
|
||||||
match *interaction {
|
match *interaction {
|
||||||
Interaction::Pressed => {
|
Interaction::Pressed => {
|
||||||
text.sections[0].value = "Press".to_string();
|
text.sections[0].value = "Press".to_string();
|
||||||
*color = GOLD.into();
|
image.color = GOLD.into();
|
||||||
}
|
}
|
||||||
Interaction::Hovered => {
|
Interaction::Hovered => {
|
||||||
text.sections[0].value = "Hover".to_string();
|
text.sections[0].value = "Hover".to_string();
|
||||||
*color = ORANGE.into();
|
image.color = ORANGE.into();
|
||||||
}
|
}
|
||||||
Interaction::None => {
|
Interaction::None => {
|
||||||
text.sections[0].value = "Button".to_string();
|
text.sections[0].value = "Button".to_string();
|
||||||
*color = Color::BLACK.into();
|
image.color = Color::WHITE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user