@@ -194,28 +194,18 @@ pub fn extract_uinodes(
194
194
continue ;
195
195
}
196
196
197
- let ( image, atlas_size, rect ) = match image {
197
+ let ( image, atlas_size, rect_min ) = match image {
198
198
UiImage :: Image ( handle) => {
199
199
let handle = handle. clone_weak ( ) ;
200
- (
201
- handle,
202
- None ,
203
- bevy_sprite:: Rect {
204
- min : Vec2 :: ZERO ,
205
- max : uinode. size ,
206
- } ,
207
- )
200
+ ( handle, None , Vec2 :: ZERO )
208
201
}
209
202
UiImage :: TextureAtlas { handle, index } => {
210
203
let handle = handle. clone_weak ( ) ;
211
204
if let Some ( atlas) = texture_atlases. get ( & handle) {
212
- (
213
- atlas. texture . clone_weak ( ) ,
214
- Some ( atlas. size ) ,
215
- atlas. textures . get ( * index) . copied ( ) . unwrap_or_else ( || {
216
- panic ! ( "TextureAtlas {:?} as no texture at index {}" , atlas, index)
217
- } ) ,
218
- )
205
+ let rect = atlas. textures . get ( * index) . copied ( ) . unwrap_or_else ( || {
206
+ panic ! ( "TextureAtlas {:?} as no texture at index {}" , atlas, index)
207
+ } ) ;
208
+ ( atlas. texture . clone_weak ( ) , Some ( atlas. size ) , rect. min )
219
209
} else {
220
210
// Skip loading images
221
211
continue ;
@@ -229,7 +219,10 @@ pub fn extract_uinodes(
229
219
extracted_uinodes. uinodes . push ( ExtractedUiNode {
230
220
transform : transform. compute_matrix ( ) ,
231
221
color : color. 0 ,
232
- rect,
222
+ rect : bevy_sprite:: Rect {
223
+ min : rect_min,
224
+ max : rect_min + uinode. size ,
225
+ } ,
233
226
image,
234
227
atlas_size,
235
228
clip : clip. map ( |clip| clip. clip ) ,
0 commit comments