Skip to content

Commit

Permalink
zoom: bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Drakulix committed Feb 20, 2025
1 parent c45a58c commit 9042f0a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/shell/zoom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,7 @@ impl OutputZoomState {
cursor_position.to_local(&output)
}
ZoomMovement::Centered => {
let mut zoomed_output_geometry =
output.zoomed_geometry(level).unwrap().to_f64();
let mut zoomed_output_geometry = output.geometry().to_f64().downscale(level);
zoomed_output_geometry.loc =
cursor_position - zoomed_output_geometry.size.downscale(2.).to_point();

Expand Down Expand Up @@ -307,8 +306,11 @@ impl ZoomState {
.loc
.to_local(&output)
.upscale(
output_geometry.size.w
/ (output_geometry.size.w - zoomed_output_geometry.size.w),
output_geometry
.size
.w
.checked_div(output_geometry.size.w - zoomed_output_geometry.size.w)
.unwrap_or(1),
)
.to_global(&output);
focal_point.x = focal_point.x.clamp(
Expand Down

0 comments on commit 9042f0a

Please sign in to comment.