-
Notifications
You must be signed in to change notification settings - Fork 583
Labels
Description
Is there an existing issue for this?
- I have searched the existing issues
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}.- 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
fitScalebased 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.
- The viewer should compute a dynamic
-
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
- I agree to follow this project's Code of Conduct
Checklist before Submitting
- Have you updated docs for it?
- Have you added unit tests?
- Have you made sure unit tests pass?
- Have you made sure code formatting is correct?
- Do Your changes passes all tests?
Reactions are currently unavailable