chore: impl PartialEq
for bevy_ui::Text
and bevy_text::TextColor
(#17606)
Adding these allows using `DetectChangesMut::set_if_neq` to only update the values when needed. Currently you need to get the inner values first (`String` and `Color`), to do any equality checks. --------- Signed-off-by: Jean Mertz <git@jeanmertz.com>
This commit is contained in:
parent
909b02e9de
commit
6bda03cc08
@ -368,8 +368,8 @@ impl Default for LineHeight {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// The color of the text for this section.
|
/// The color of the text for this section.
|
||||||
#[derive(Component, Copy, Clone, Debug, Deref, DerefMut, Reflect)]
|
#[derive(Component, Copy, Clone, Debug, Deref, DerefMut, Reflect, PartialEq)]
|
||||||
#[reflect(Component, Default, Debug)]
|
#[reflect(Component, Default, Debug, PartialEq)]
|
||||||
pub struct TextColor(pub Color);
|
pub struct TextColor(pub Color);
|
||||||
|
|
||||||
impl Default for TextColor {
|
impl Default for TextColor {
|
||||||
|
@ -89,8 +89,8 @@ impl Default for TextNodeFlags {
|
|||||||
/// TextLayout::new_with_justify(JustifyText::Center)
|
/// TextLayout::new_with_justify(JustifyText::Center)
|
||||||
/// ));
|
/// ));
|
||||||
/// ```
|
/// ```
|
||||||
#[derive(Component, Debug, Default, Clone, Deref, DerefMut, Reflect)]
|
#[derive(Component, Debug, Default, Clone, Deref, DerefMut, Reflect, PartialEq)]
|
||||||
#[reflect(Component, Default, Debug)]
|
#[reflect(Component, Default, Debug, PartialEq)]
|
||||||
#[require(Node, TextLayout, TextFont, TextColor, TextNodeFlags, ContentSize)]
|
#[require(Node, TextLayout, TextFont, TextColor, TextNodeFlags, ContentSize)]
|
||||||
pub struct Text(pub String);
|
pub struct Text(pub String);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user