Is there an existing issue for this?
What happened?
The previously implemented Zoom-on-Scroll feature (refer issue #528) does not fully meet the expected behavior, usability requirements. Several core zoom mechanics such as minimum zoom limits, axis-dependent centering, and auto-recentering are implemented incorrectly.
Current Behavior
minScale and maxScale are hardcoded to {0.1} and {8}.
- The image can be zoomed out to a tiny size, much smaller than the viewport.
- Zooming is always mouse-anchored, even when the image still fits inside the screen.
- When zooming out to minimum, the image may remain off-center due to preserved panning offsets.
Expected Behavior
-
Dynamic Minimum Zoom ("Fit to Screen")
- The viewer should compute a dynamic
fitScale based on the image’s natural dimensions & the viewer container size.
- The minimum zoom level should be the "fit-to-screen" scale only when the image is larger than the viewport, and original resolution scale when the image is smaller than or equal to the viewport. Users should not be able to zoom out past this point.
- No tiny or floating images.
-
Axis-Dependent Zoom Anchoring
Zooming should behave differently depending on image overflow:
Case 1 - No Overflow
- Image fully fits inside viewport in both directions
- Zoom is centered
- No panning or mouse anchoring yet.
Case 2 - Overflow in One Axis
- If width overflows >> mouse-anchored zoom horizontally
- If height overflows >> mouse-anchored zoom vertically
- Non-overflowing axis stays centered (position locked to 0)
Case 3 - Overflow in Both Axes
- Full mouse-anchored zoom behavior
-
Automatic Re-centering at Minimum Zoom
When zooming out back to minimum:
Case 1 - Overflow in Both Axes
- Full mouse-anchored zoom behavior
Case 2 - No Overflow
- The image should snap back to centered
- All panning offsets should gradually reset to 0
- Prevents the image from being stuck in a corner after zooming/panning
Steps to Reproduce
- Open any image in Media View.
- Scroll up and down randomly
- See issue
Video explaination:
https://drive.google.com/file/d/1yr7jHZgVyK4-930m20peNzkj9uw7ihto/view?usp=sharing
Record
Checklist before Submitting
Is there an existing issue for this?
What happened?
The previously implemented Zoom-on-Scroll feature (refer issue #528) does not fully meet the expected behavior, usability requirements. Several core zoom mechanics such as minimum zoom limits, axis-dependent centering, and auto-recentering are implemented incorrectly.
Current Behavior
minScaleandmaxScaleare hardcoded to {0.1} and {8}.Expected Behavior
Dynamic Minimum Zoom ("Fit to Screen")
fitScalebased on the image’s natural dimensions & the viewer container size.Axis-Dependent Zoom Anchoring
Zooming should behave differently depending on image overflow:
Case 1 - No Overflow
Case 2 - Overflow in One Axis
Case 3 - Overflow in Both Axes
Automatic Re-centering at Minimum Zoom
When zooming out back to minimum:
Case 1 - Overflow in Both Axes
Case 2 - No Overflow
Steps to Reproduce
Video explaination:
https://drive.google.com/file/d/1yr7jHZgVyK4-930m20peNzkj9uw7ihto/view?usp=sharing
Record
Checklist before Submitting