Skip to content

Commit

Permalink
fix overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
ugai committed Nov 6, 2022
1 parent 253cf8d commit 665b167
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@ pub fn set_window_to_center(window: &Window, monitor_handle: &MonitorHandle) {
let monitor_topleft = monitor_handle.position();
let monitor_size = monitor_handle.size();
let pos = PhysicalPosition {
x: monitor_topleft.x + ((monitor_size.width - window_size.width) as i32 / 2),
y: monitor_topleft.y + ((monitor_size.height - window_size.height) as i32 / 2),
x: monitor_topleft.x + ((monitor_size.width.saturating_sub(window_size.width)) as i32 / 2),
y: monitor_topleft.y
+ ((monitor_size.height.saturating_sub(window_size.height)) as i32 / 2),
};
window.set_outer_position(pos);
}
Expand Down

0 comments on commit 665b167

Please sign in to comment.