image/zoom: Zoom >=1 no best fit for ExactVolatile

The best-fit calculation would consider levels >=1 for best-fit. This
seems fundamentally wrong since that should be reserved for LargeFit.

This caused zoom-in to fail since best-fit was considered instead. But
that best-fit was computed with BestFit mode since the mode changed in
between in zoom_to_full.

Fixes #556
This commit is contained in:
Sophie Herold 2025-12-22 14:14:38 +01:00
parent 73c921b042
commit a761eb5b2d
2 changed files with 3 additions and 2 deletions

View file

@ -0,0 +1 @@
Zooming in would not work via the zoom menu, if the resulting zoom state would still fit the image inside the window.

View file

@ -48,9 +48,9 @@ impl imp::LpImage {
let max_zoom_factor = match self.fit_mode.get() {
// Do not allow to zoom larger than original size
FitMode::BestFit => 1.,
FitMode::BestFit | FitMode::ExactVolatile => 1.,
// Allow arbitrary zoom
FitMode::LargeFit | FitMode::ExactVolatile => f64::MAX,
FitMode::LargeFit => f64::MAX,
};
let default_zoom = if texture_aspect_ratio > widget_aspect_ratio {