Zoom improvements - #1390
Conversation
|
Preview removed. |
Coverage Report
File Coverage
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
If it helps, you can preview how embeds will look by adding |
- Remove fit width and fit height, which scaled each page independently - Add auto, which scales the whole document uniformly to a max of 100% of its intrinsic size - Move zoom computation to ViewerState - Raise shared state from PDFPage to PDF
|
You're right, but it seems weird that it wouldn't be readable at 100%. Ended up going on a deep dive into PDF sizing. PDFs don't have intrinsic pixel dimensions, they're sized in physical units. It looks like DocumentCloud is treating the values in
A point is 1/72 of an inch, and CSS pixels are defined as 1/96 inch, so the conversion is
So I think we have three options here:
I think users would reasonably expect a normal document to be legible at 100%, so I'm in favor of 2 or 3. |
|
Either 2 or 3 seem totally reasonable. I think try 2, just to match what pdf.js does by default, and then see if there's a good reason to do 3. |
|
Updated to use |
|
Yes, much better. The horizontal document I have linked above ends up at 78%, which fills the viewport. A letter-sized document is at 100%, and that's readable. I think we're good. |
|
I'm getting this warning in the console: https://svelte.dev/docs/svelte/runtime-warnings#Client-warnings-derived_inert I have this document open in search mode: https://preview-1390.staging.documentcloud.org/documents/20011264-251118397v1/?mode=search&q=emergent Click on any search result and you should see it. Doesn't seem like it's breaking anything now but can't promise it won't later. |
|
I'm seeing that on main too, don't think it's related to this PR. Looks like the issue is that this derived's dependencies change when the navigation happens, so |
|
OK, I wonder if it's related to #1139 (and we can address it there). |
|
Just pushed a change that fixes a performance regression related to the pin-x animation, and improves zoom performance above baseline by applying |




Closes #1084 and #1389. Introduces a new default zoom mode for documents,
Auto, and zoom in/zoom out buttons to step between zoom levels.Key changes:
Autozoom mode is added as the new default. This mode sizes the document so that its widest page fills 100% of the viewer. When the viewer width changes (from a window resize or toggling a sidebar), the zoom level changes too.Fit widthandFit heightzoom modes are removed. Both of these sized pages individually to fill the viewer; removing them means that every page of the document is presented at a uniform zoom level.Update:
Implements pinch-to-zoom on mobile devices