Skip to content

BUG: Dynamic Zoom on Scroll Not Working in Production #1293

@rohan-pandeyy

Description

@rohan-pandeyy

Is there an existing issue for this?

  • I have searched the existing issues

What happened?

Description

The dynamic minimum zoom / fit-to-screen behavior implemented in #656 worked correctly in development mode, but after the production release it was found to be broken in production builds.

The expected behavior remains unchanged.

Reference issue:
#656

Reference video: (Very Important ⭐⭐⭐⭐⭐)
https://drive.google.com/file/d/1yr7jHZgVyK4-930m20peNzkj9uw7ihto/view?usp=sharing


Expected Behavior

Dynamic Minimum Zoom ("Fit to Screen")

The viewer should compute a dynamic fitScale using:

  • image natural dimensions
  • viewer container size

Minimum zoom rules:

  • If the image is larger than the viewport:
    • minimum zoom = fit-to-screen scale
  • If the image is smaller than or equal to the viewport:
    • minimum zoom = original scale

Users should not be able to zoom out past this limit.

This prevents:

  • tiny images
  • floating images
  • excessive empty space

Axis-Dependent Zoom Anchoring

Case 1 — No Overflow

If the image fully fits inside the viewport:

  • zoom remains centered
  • no panning or mouse anchoring

Case 2 — Overflow in One Axis

  • width overflow → mouse-anchored zoom horizontally
  • height overflow → mouse-anchored zoom vertically

The non-overflowing axis should remain centered (0 offset).

Case 3 — Overflow in Both Axes

  • full mouse-anchored zoom behavior

Automatic Re-centering at Minimum Zoom

When zooming back out to minimum zoom and overflow no longer exists:

  • image should snap back to center
  • pan offsets should reset to 0

This prevents images from remaining stuck in corners after zooming/panning.


Current Problem

The feature works in development but not in production builds.

Further investigation is required to identify the production-only regression.


Acceptance Criteria

  • Dynamic minimum zoom works correctly in production
  • Users cannot zoom out past allowed minimum
  • Axis-dependent zoom anchoring behaves correctly
  • Re-centering works reliably
  • Dev and production behavior are consistent

Record

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

Labels

Type

No fields configured for Bug.

Projects

Status

In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions