Skip to content

Commit 4e91891

Browse files
committed
fix: clamp zoom in gesture instead of early return
1 parent 6239fdb commit 4e91891

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

crates/rnote-ui/src/canvaswrapper.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -580,11 +580,8 @@ mod imp {
580580
move |gesture, scale| {
581581
let canvas = canvaswrapper.canvas();
582582
let old_zoom = canvas.engine_ref().camera.total_zoom();
583-
let new_zoom = zoom_begin.get() * scale;
584-
585-
if !(Camera::ZOOM_MIN..=Camera::ZOOM_MAX).contains(&new_zoom) {
586-
return;
587-
}
583+
let new_zoom =
584+
(zoom_begin.get() * scale).clamp(Camera::ZOOM_MIN, Camera::ZOOM_MAX);
588585

589586
let mut widget_flags = canvas.engine_mut().zoom_w_timeout(new_zoom);
590587

0 commit comments

Comments
 (0)