@pdf-viewer/react
Version:
A react-pdf-viewer component for React and Next.js. Suitable for react-pdf document.
23 lines (22 loc) • 542 B
JavaScript
import { SCROLL_BAR_WIDTH as s, PAGE_PADDING as f } from "./constants.js";
import { ZoomLevel as t, ViewMode as u } from "./types.js";
const l = (o, e, n, r, m, a) => {
if (typeof o == "number")
return o;
switch (o) {
case t.PAGE_FIT:
const A = a === u.DUAL_PAGE ? 2 * r : r, c = Math.min(
(e - s) / A,
(n - f) / m
);
return Math.floor(c * 100);
case t.PAGE_WIDTH:
return Math.floor(e / r * 100);
case t.ACTUAL:
default:
return 100;
}
};
export {
l as getZoomLevel
};