From 4580a911714a4a119f4d0570eec8c7674e9eda49 Mon Sep 17 00:00:00 2001 From: ickshonpe Date: Sat, 22 Apr 2023 22:30:38 +0100 Subject: [PATCH] `measure_text_system` text query fix (#8466) # Objective The first query of `measure_text_system`'s `text_queries` `ParamSet` queries for all changed `Text` meaning that non-UI `Text` entities could be added to its queue. ## Solution Add a `With` query filter. --- ## Changelog changes: * Added a `With` query filter to first query of `measure_text_system`'s `text_queries` `ParamSet` to ensure that only UI node entities are added to its local queue. * Fixed comment (text is not computed on changes to style). --- crates/bevy_ui/src/widget/text.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/bevy_ui/src/widget/text.rs b/crates/bevy_ui/src/widget/text.rs index d8395d4f26..f58684a757 100644 --- a/crates/bevy_ui/src/widget/text.rs +++ b/crates/bevy_ui/src/widget/text.rs @@ -68,7 +68,7 @@ pub fn measure_text_system( ui_scale: Res, mut text_pipeline: ResMut, mut text_queries: ParamSet<( - Query>, + Query, With)>, Query, With)>, Query<(&Text, &mut CalculatedSize)>, )>, @@ -82,7 +82,7 @@ pub fn measure_text_system( #[allow(clippy::float_cmp)] if *last_scale_factor == scale_factor { - // Adds all entities where the text or the style has changed to the local queue + // Adds all entities where the text has changed to the local queue for entity in text_queries.p0().iter() { if !queued_text.contains(&entity) { queued_text.push(entity);