2121use bevy:: {
2222 app:: { App , Plugin } ,
2323 asset:: Assets ,
24- camera:: { Projection , RenderTarget } ,
24+ camera:: RenderTarget ,
2525 ecs:: query:: QueryEntityError ,
2626 math:: { IRect , IVec2 } ,
2727 prelude:: { Commands , Component , Entity , In , Query , ResMut , Window , With , default} ,
@@ -395,8 +395,11 @@ pub fn destroy(
395395pub fn resize (
396396 In ( ( window_entity, width, height) ) : In < ( Entity , u32 , u32 ) > ,
397397 mut windows : Query < & mut Window > ,
398- mut graphics_query : Query < ( & RenderTarget , & mut SurfaceSize , & mut Projection ) > ,
398+ mut graphics_query : Query < ( & RenderTarget , & mut SurfaceSize ) > ,
399399) -> Result < ( ) > {
400+ let width = width. max ( 1 ) ;
401+ let height = height. max ( 1 ) ;
402+
400403 if let Ok ( mut window) = windows. get_mut ( window_entity) {
401404 let scale = window. resolution . scale_factor ( ) ;
402405 let physical_w = ( width as f32 * scale) as u32 ;
@@ -405,14 +408,12 @@ pub fn resize(
405408 . resolution
406409 . set_physical_resolution ( physical_w, physical_h) ;
407410 }
408-
409- for ( target, mut surface_size, mut projection) in graphics_query. iter_mut ( ) {
411+
412+ // SurfaceSize changes on resize, if not handled will break APIs dependent on correct SurfaceSize
413+ for ( target, mut surface_size) in graphics_query. iter_mut ( ) {
410414 if let RenderTarget :: Window ( WindowRef :: Entity ( surface) ) = * target {
411415 if surface == window_entity {
412416 * surface_size = SurfaceSize ( width, height) ;
413- if let Projection :: Custom ( ref mut custom) = * projection {
414- custom. update ( width as f32 , height as f32 ) ;
415- }
416417 }
417418 }
418419 }
0 commit comments