Issue Summary
Zoom-fit scale not updated correctly on window resize / maximize
Description
In DynamicView.resizeEvent, there is a FIXME comment noting: "Se la finestra viene massimizzata, il valore di fit_scale non si aggiorna" (when the window is maximized, fit_scale is not updated).
The current logic calls zoom_fit() only when the existing transform scale is less than or equal to fit_scale; otherwise, it just emits notify_change().
This means that after maximizing or significantly resizing the window, the fit-to-window scaling can become out-of-sync, causing suboptimal zoom behavior.
Steps to Reproduce
- Open any tool that uses
ImageViewer / DynamicView (e.g., Original Image).
- Load an image and double-click to fit it.
- Maximize or resize the main window to a much larger size.
- Observe that the fitted image may no longer optimally fill the viewport due to stale
fit_scale.
Expected Result
When the window is maximized or resized, the fit-scale should be recomputed so that "Fit" always behaves consistently with the new window dimensions.
Actual Result
fit_scale can remain based on the previous size, leading to incorrect zoom levels after maximizing; the code itself flags this as a known issue via the FIXME comment.
Affected Files
Suggested Fix
Recompute fit_scale on resize (e.g., always call zoom_fit() when in fit mode), or track a "fit mode" state and recalculate scale whenever the viewport changes significantly. Remove the FIXME once behavior is corrected.
Issue Summary
Zoom-fit scale not updated correctly on window resize / maximize
Description
In
DynamicView.resizeEvent, there is aFIXMEcomment noting: "Se la finestra viene massimizzata, il valore di fit_scale non si aggiorna" (when the window is maximized,fit_scaleis not updated).The current logic calls
zoom_fit()only when the existing transform scale is less than or equal tofit_scale; otherwise, it just emitsnotify_change().This means that after maximizing or significantly resizing the window, the fit-to-window scaling can become out-of-sync, causing suboptimal zoom behavior.
Steps to Reproduce
ImageViewer/DynamicView(e.g., Original Image).fit_scale.Expected Result
When the window is maximized or resized, the fit-scale should be recomputed so that "Fit" always behaves consistently with the new window dimensions.
Actual Result
fit_scalecan remain based on the previous size, leading to incorrect zoom levels after maximizing; the code itself flags this as a known issue via the FIXME comment.Affected Files
gui/viewer.pySuggested Fix
Recompute
fit_scaleon resize (e.g., always callzoom_fit()when in fit mode), or track a "fit mode" state and recalculate scale whenever the viewport changes significantly. Remove the FIXME once behavior is corrected.