Skip to content
This repository was archived by the owner on Apr 23, 2026. It is now read-only.

B-26364 Zooming, scrolling, and other issues#19

Merged
r-mettler merged 4 commits into
mainfrom
B-26364-viewer-fit
Apr 13, 2026
Merged

B-26364 Zooming, scrolling, and other issues#19
r-mettler merged 4 commits into
mainfrom
B-26364-viewer-fit

Conversation

@antgmann
Copy link
Copy Markdown

@antgmann antgmann commented Mar 31, 2026

B-26364

Important

This backlog is a downstream dependency on Alex's PR for version 1.4.7 HERE

These changes provide some rather significant adjustments to how we display images, as well as how pdfs appear visually. Because of this, a new minor version (1.5.0) may be appropriate. Amongst the improvements:

  • PDFs and Images both now find a 'best fit zoom' by being equal to or slightly less than the width of the container
  • PDFs and Images both now have increased zoom steps
  • Images will now re-render upon transformation like PDFs do (helps to prevent them from 'spilling over' beyond scrollable overflow)
  • Zoom steps are now mapped
  • PDFs minor offsets, overflow, and scrolling improvements
  • Significant transformation-responsive offset, padding, styling improvements for images

Testing Instructions
These changes are made based upon Alex's changes for 26359, hence the dependency. In order to best test these changes, please check out the B-26364 branch in our repository before testing.
Also, if you want to see a before and after rather than just the after, do step 3 first.

  1. Update your local to use "@transcom/react-file-viewer": "git+https://github.com/transcom/react-file-viewer#B-26364-viewer-fit", in package.json
  2. Clear and reinstall your npm modules with rm -rf node_modules then yarn install, we don't want a frozen lockfile (rm -rf node_modules && yarn install && ./scripts/copy-react-file-viewer && make client_run)
  3. Anywhere in the app upload a handful of images and PDFs that you'll be able to review in the document viewer like orders and navigate to viewing them. Best if also done for PPM docs, payment requests, etc.
  4. Verify the center component where the image is displayed fills the space available to it, the vertical scrollbar is flush against the right sidebar, and the horizontal scrollbar is not hidden by the the controls bar at the bottom.
  5. Verify that documents load at a reasonable zoom level, are visible, and transform well when rotated and zoomed.

@antgmann antgmann self-assigned this Mar 31, 2026
@antgmann antgmann requested review from ajlusk and r-mettler March 31, 2026 14:18
@antgmann antgmann changed the title Fix zooming, scrolling, and other issues B-26364 Zooming, scrolling, and other issues Mar 31, 2026
@antgmann antgmann requested a review from a team March 31, 2026 17:39
@antgmann antgmann force-pushed the B-26364-viewer-fit branch from d78bdbe to 32a72b7 Compare April 6, 2026 16:31
@antgmann antgmann marked this pull request as ready for review April 8, 2026 16:39
Copy link
Copy Markdown

@ajlusk ajlusk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most file types & sizes I've tested seem to be the same or improved but one core scenario is a bit worse. Vertical (but not horizontal) PDFs seem to default to one or two levels too zoomed in, at least is smaller windows.

Improved Comparisons:
Before:
Image

After:
Image

Before:
Image

After:
Image

Worse Comparison:
Before:
Image

After:
Image

After (after having saved a 90 degree rotated view):
Image

I also see the same effect in reverse when I rotate a default horizontal PDF 90 degrees. It goes from appropriate zoom to one zoom level too zoomed in.

@antgmann
Copy link
Copy Markdown
Author

antgmann commented Apr 9, 2026

@ajlusk newest commit changes the nearest horizontal zoom level to 95% of the viewer space to instead be 80%. This has no effect on most of the files that already display well (worst case they'll be one step away from optimized where the zoom steps mean less), but ensures a bit of margin shows for docs that are taller/wider. The zoom won't change on rotation, so you still may see the entire horizontal space taken when rotating a portrait pdf, but that's something that hasn't been asked for yet

@antgmann antgmann requested a review from a team April 9, 2026 20:31
2.25,
2.5,
2.75,
3.0,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason this is different than the PDF options? Seems you added some values, why not all of them?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Preface by saying that previously 200% was the zoom max for photos, so really it was just my discretion based on testing, and I could be convinced to change it

I added these just because I found them to be useful when testing smaller images with text. While we could bring it in line with PDFs and allow up to 500% zoom, I don't know that it would really be an added benefit because any text on images small enough to need that kind of zoom would be pretty illegible anyways. Happy to discuss further though

@ajlusk
Copy link
Copy Markdown

ajlusk commented Apr 10, 2026

@ajlusk newest commit changes the nearest horizontal zoom level to 95% of the viewer space to instead be 80%. This has no effect on most of the files that already display well (worst case they'll be one step away from optimized where the zoom steps mean less), but ensures a bit of margin shows for docs that are taller/wider. The zoom won't change on rotation, so you still may see the entire horizontal space taken when rotating a portrait pdf, but that's something that hasn't been asked for yet

This all looks good. Not expecting it to adjust zoom on rotation but it is adjusting zoom on saving a rotation so that's nice.

@r-mettler r-mettler merged commit 5378f11 into main Apr 13, 2026
1 check passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants