image/zoom: Fix forcing center aim not working

This commit is contained in:
Sophie Herold 2024-09-11 12:30:38 +02:00
parent 9d87b688d9
commit 1f28884847
2 changed files with 7 additions and 4 deletions

View file

@ -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.)