diff --git a/news.d/47.0/fixed-zoom-center b/news.d/47.0/fixed-zoom-center new file mode 100644 index 0000000..f7c4327 --- /dev/null +++ b/news.d/47.0/fixed-zoom-center @@ -0,0 +1 @@ +Forcing the zoom to the center of the image is now working again. This is especially noticable when using the touchpads pinch gesture. diff --git a/src/widgets/image/zoom.rs b/src/widgets/image/zoom.rs index 8247e9d..492c49a 100644 --- a/src/widgets/image/zoom.rs +++ b/src/widgets/image/zoom.rs @@ -179,16 +179,18 @@ impl imp::LpImage { let img_pos = if let Some(img_pos) = self.zoom_cursor_target.get() { // Point is stored for animation img_pos - } else if let Some(cur_pos) = cur { - // Get image coordinate from the passed cursor position - self.widget_to_img_coord(cur_pos) } else { // Use center of viewport self.widget_to_img_coord((self.widget_width() / 2., self.widget_height() / 2.)) }; let cur_pos = if let Some(cur) = cur { - cur + if self.zoom_cursor_target.get().is_some() { + cur + } else { + // Use center of widget for cursor since `img_pos` is locked in on center + (self.widget_width() / 2., self.widget_height() / 2.) + } } else { // Use center of widget since no cursor position available (self.widget_width() / 2., self.widget_height() / 2.)