image/zoom: Use viewport center for buttons

Before, the image center was used, which would cause a jump if the
viewport was changed before.

Fixes #392
This commit is contained in:
Sophie Herold 2024-08-01 01:12:32 +02:00
parent f67153b3ee
commit c1e6ccedab
2 changed files with 3 additions and 3 deletions

View file

@ -183,9 +183,8 @@ impl imp::LpImage {
// Get image coordinate from the passed cursor position
self.widget_to_img_coord(cur_pos)
} else {
// Use center of image
let (width, height) = obj.image_size();
(width as f64 / 2., height as f64 / 2.)
// 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 {