Skip to content

Commit

Permalink
Text2d doesn't recompute text on changes to the text's bounds (bevyen…
Browse files Browse the repository at this point in the history
…gine#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.
  • Loading branch information
ickshonpe authored and Shfty committed Mar 19, 2023
1 parent 13764d4 commit 62b2bbc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions crates/bevy_text/src/text2d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ pub fn update_text2d_layout(
mut text_query: Query<(
Entity,
Ref<Text>,
&Text2dBounds,
Ref<Text2dBounds>,
Option<&mut TextLayoutInfo>,
)>,
) {
Expand All @@ -182,7 +182,7 @@ pub fn update_text2d_layout(
.unwrap_or(1.0);

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(
scale_value(bounds.size.x, scale_factor),
scale_value(bounds.size.y, scale_factor),
Expand Down

0 comments on commit 62b2bbc

Please sign in to comment.