You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The same logic needs to be re-implemented in other embedders that implement gestures-based zoom, such as in ngx-extended-pdf-viewer for angular (or the internal one I'm helping with, which re-implements similar logic).
What I would like the viewer to provide is:
a center: [x, y] parameter in increaseScale/decreaseScale that allows customizing the "zoom center" rather than always scrolling to _location.top, _location.left and then having to manually adjust it separately. Having to compute the "scroll adjustment" can be tricky if you don't know exactly how the various position/zoom data from the viewer fit together.
an updateScale function, that zooms in if the scaleFactor > 1 || steps > 0, and zooms out if scaleFactor < 1 || steps < 0
The first one is more important, since it centralizes the "adjust scroll after zoom" logic in a single place (the viewer) rather than it being split across the viewer and the wrapper. The second one is just for convenience.
The text was updated successfully, but these errors were encountered:
To properly implement zoom gestures (Ctrl+wheel, or pinch-to-zoom), applications that embed the viewer currently have to:
pdfViewer.decreaseScale
orpdfViewer.increaseScale
, depending on whether it's a zoom in or outdecreaseScale
/increaseScale
preserve the position of the top-left visible corner.As an example, in the PDF.js app, (2) needs to be checked 4 times (one for each zoom input method):
pdf.js/web/app.js
Lines 2641 to 2646 in b676540
pdf.js/web/app.js
Lines 2679 to 2685 in b676540
pdf.js/web/app.js
Lines 2800 to 2806 in b676540
pdf.js/web/app.js
Lines 2813 to 2819 in b676540
And for (3) it has a "post-zoom scroll fixup" implemented at
pdf.js/web/app.js
Lines 2101 to 2109 in b676540
The same logic needs to be re-implemented in other embedders that implement gestures-based zoom, such as in ngx-extended-pdf-viewer for angular (or the internal one I'm helping with, which re-implements similar logic).
What I would like the viewer to provide is:
center: [x, y]
parameter inincreaseScale
/decreaseScale
that allows customizing the "zoom center" rather than always scrolling to_location.top, _location.left
and then having to manually adjust it separately. Having to compute the "scroll adjustment" can be tricky if you don't know exactly how the various position/zoom data from the viewer fit together.updateScale
function, that zooms in if thescaleFactor > 1 || steps > 0
, and zooms out ifscaleFactor < 1 || steps < 0
The first one is more important, since it centralizes the "adjust scroll after zoom" logic in a single place (the viewer) rather than it being split across the viewer and the wrapper. The second one is just for convenience.
The text was updated successfully, but these errors were encountered: