File tree 2 files changed +7
-2
lines changed
core/tauri-runtime-wry/src
2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " tauri-runtime-wry " : patch
3
+ ---
4
+
5
+ Fix ` window.center ` panic when window size is bigger than screen size.
Original file line number Diff line number Diff line change @@ -2476,8 +2476,8 @@ fn on_window_close<'a>(
2476
2476
fn center_window ( window : & Window , window_size : WryPhysicalSize < u32 > ) -> Result < ( ) > {
2477
2477
if let Some ( monitor) = window. current_monitor ( ) {
2478
2478
let screen_size = monitor. size ( ) ;
2479
- let x = ( screen_size. width - window_size. width ) / 2 ;
2480
- let y = ( screen_size. height - window_size. height ) / 2 ;
2479
+ let x = ( screen_size. width as i32 - window_size. width as i32 ) / 2 ;
2480
+ let y = ( screen_size. height as i32 - window_size. height as i32 ) / 2 ;
2481
2481
window. set_outer_position ( WryPhysicalPosition :: new ( x, y) ) ;
2482
2482
Ok ( ( ) )
2483
2483
} else {
You can’t perform that action at this time.
0 commit comments