UNPKG

@pdf-viewer/react

Version:

A react-pdf-viewer component for React and Next.js. Suitable for react-pdf document.

24 lines (23 loc) 531 B
import { SCROLL_BAR_WIDTH as a } from "./constants.js"; import { ViewMode as u, ZoomLevel as r } from "./types.js"; const Z = (o, t, m, e, c, s) => { if (typeof o == "number") return o; const n = s === u.DUAL_PAGE ? 2 * e : e; switch (o) { case r.PAGE_FIT: const f = Math.min( (t - a) / n, m / c ); return Math.floor(f * 100); case r.PAGE_WIDTH: return Math.floor((t - a) / n * 100); case r.ACTUAL: default: return 100; } }; export { Z as getZoomLevel };