mirror of
https://github.com/tauri-apps/tauri.git
synced 2024-12-25 03:33:36 +03:00
This commit is contained in:
parent
1e336b6872
commit
76ce9f61dd
5
.changes/core-center-window.md
Normal file
5
.changes/core-center-window.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
"tauri-runtime-wry": patch
|
||||
---
|
||||
|
||||
Fix `window.center` panic when window size is bigger than screen size.
|
@ -2476,8 +2476,8 @@ fn on_window_close<'a>(
|
||||
fn center_window(window: &Window, window_size: WryPhysicalSize<u32>) -> Result<()> {
|
||||
if let Some(monitor) = window.current_monitor() {
|
||||
let screen_size = monitor.size();
|
||||
let x = (screen_size.width - window_size.width) / 2;
|
||||
let y = (screen_size.height - window_size.height) / 2;
|
||||
let x = (screen_size.width as i32 - window_size.width as i32) / 2;
|
||||
let y = (screen_size.height as i32 - window_size.height as i32) / 2;
|
||||
window.set_outer_position(WryPhysicalPosition::new(x, y));
|
||||
Ok(())
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user