Text2d doesn't recompute text on changes to the text's bounds (#7846)
# Objective Text2d entity's text needs to be recomputed when their bounds are changed, but it isn't. # Solution Change `update_text2d_layout` to query for `Ref<Text2dBounds>` and recompute the text if the bounds have changed.
This commit is contained in:
parent
9e6ad4607f
commit
f732172c73
@ -168,7 +168,7 @@ pub fn update_text2d_layout(
|
|||||||
mut text_query: Query<(
|
mut text_query: Query<(
|
||||||
Entity,
|
Entity,
|
||||||
Ref<Text>,
|
Ref<Text>,
|
||||||
&Text2dBounds,
|
Ref<Text2dBounds>,
|
||||||
Option<&mut TextLayoutInfo>,
|
Option<&mut TextLayoutInfo>,
|
||||||
)>,
|
)>,
|
||||||
) {
|
) {
|
||||||
@ -182,7 +182,7 @@ pub fn update_text2d_layout(
|
|||||||
.unwrap_or(1.0);
|
.unwrap_or(1.0);
|
||||||
|
|
||||||
for (entity, text, bounds, text_layout_info) in &mut text_query {
|
for (entity, text, bounds, text_layout_info) in &mut text_query {
|
||||||
if factor_changed || text.is_changed() || queue.remove(&entity) {
|
if factor_changed || text.is_changed() || bounds.is_changed() || queue.remove(&entity) {
|
||||||
let text_bounds = Vec2::new(
|
let text_bounds = Vec2::new(
|
||||||
scale_value(bounds.size.x, scale_factor),
|
scale_value(bounds.size.x, scale_factor),
|
||||||
scale_value(bounds.size.y, scale_factor),
|
scale_value(bounds.size.y, scale_factor),
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user