@@ -3,7 +3,6 @@ use crate::{
33} ;
44use bevy_asset:: { Assets , Handle } ;
55
6- #[ cfg( feature = "bevy_text" ) ]
76use bevy_ecs:: query:: Without ;
87use bevy_ecs:: {
98 prelude:: Component ,
@@ -15,8 +14,6 @@ use bevy_math::Vec2;
1514use bevy_reflect:: { std_traits:: ReflectDefault , Reflect } ;
1615use bevy_render:: texture:: Image ;
1716use bevy_sprite:: TextureAtlas ;
18- #[ cfg( feature = "bevy_text" ) ]
19- use bevy_text:: Text ;
2017use bevy_window:: { PrimaryWindow , Window } ;
2118
2219/// The size of the image's texture
@@ -73,20 +70,18 @@ impl Measure for ImageMeasure {
7370 }
7471}
7572
73+ #[ cfg( feature = "bevy_text" ) ]
74+ type UpdateImageFilter = ( With < Node > , Without < bevy_text:: Text > ) ;
75+ #[ cfg( not( feature = "bevy_text" ) ) ]
76+ type UpdateImageFilter = With < Node > ;
77+
7678/// Updates content size of the node based on the image provided
7779pub fn update_image_content_size_system (
7880 mut previous_combined_scale_factor : Local < f64 > ,
7981 windows : Query < & Window , With < PrimaryWindow > > ,
8082 ui_scale : Res < UiScale > ,
8183 textures : Res < Assets < Image > > ,
82- #[ cfg( feature = "bevy_text" ) ] mut query : Query <
83- ( & mut ContentSize , & UiImage , & mut UiImageSize ) ,
84- ( With < Node > , Without < Text > ) ,
85- > ,
86- #[ cfg( not( feature = "bevy_text" ) ) ] mut query : Query <
87- ( & mut ContentSize , & UiImage , & mut UiImageSize ) ,
88- With < Node > ,
89- > ,
84+ mut query : Query < ( & mut ContentSize , & UiImage , & mut UiImageSize ) , UpdateImageFilter > ,
9085) {
9186 let combined_scale_factor = windows
9287 . get_single ( )
@@ -120,23 +115,14 @@ pub fn update_atlas_content_size_system(
120115 windows : Query < & Window , With < PrimaryWindow > > ,
121116 ui_scale : Res < UiScale > ,
122117 atlases : Res < Assets < TextureAtlas > > ,
123- #[ cfg( feature = "bevy_text" ) ] mut atlas_query : Query <
124- (
125- & mut ContentSize ,
126- & Handle < TextureAtlas > ,
127- & UiTextureAtlasImage ,
128- & mut UiImageSize ,
129- ) ,
130- ( With < Node > , Without < Text > , Without < UiImage > ) ,
131- > ,
132- #[ cfg( not( feature = "bevy_text" ) ) ] mut atlas_query : Query <
118+ mut atlas_query : Query <
133119 (
134120 & mut ContentSize ,
135121 & Handle < TextureAtlas > ,
136122 & UiTextureAtlasImage ,
137123 & mut UiImageSize ,
138124 ) ,
139- ( With < Node > , Without < UiImage > ) ,
125+ ( UpdateImageFilter , Without < UiImage > ) ,
140126 > ,
141127) {
142128 let combined_scale_factor = windows
0 commit comments