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:
parent
f67153b3ee
commit
c1e6ccedab
2 changed files with 3 additions and 3 deletions
1
news.d/47.beta/fixed-zoom-into-image-center
Normal file
1
news.d/47.beta/fixed-zoom-into-image-center
Normal file
|
|
@ -0,0 +1 @@
|
|||
Zoom into viewport center via buttons. Before, the image center was used, which would cause a jump if the viewport had been changed.
|
||||
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue