remove redundant level condition; simplify level early return on ZoomMovement::Centered
This commit is contained in:
parent
4d14f5568f
commit
0596cce40d
2 changed files with 6 additions and 8 deletions
|
|
@ -2491,13 +2491,11 @@ impl Shell {
|
||||||
movement: zoom_config.view_moves,
|
movement: zoom_config.view_moves,
|
||||||
});
|
});
|
||||||
|
|
||||||
if level > 1.0 {
|
self.update_focal_point(
|
||||||
self.update_focal_point(
|
seat,
|
||||||
seat,
|
seat.get_pointer().unwrap().current_location().as_global(),
|
||||||
seat.get_pointer().unwrap().current_location().as_global(),
|
zoom_config.view_moves,
|
||||||
zoom_config.view_moves,
|
);
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn update_focal_point(
|
pub fn update_focal_point(
|
||||||
|
|
|
||||||
|
|
@ -319,7 +319,7 @@ impl ZoomState {
|
||||||
ZoomMovement::Centered => {
|
ZoomMovement::Centered => {
|
||||||
let center = (output_geometry.size / 2.).to_point();
|
let center = (output_geometry.size / 2.).to_point();
|
||||||
|
|
||||||
if level <= 1.0 + f64::EPSILON {
|
if level == 1.0 {
|
||||||
// Prevent focal point jumping to top-left corner (0, 0) on zoom out
|
// Prevent focal point jumping to top-left corner (0, 0) on zoom out
|
||||||
output_state_ref.focal_point = center;
|
output_state_ref.focal_point = center;
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue