UNPKG

@pdf-viewer/react

Version:

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

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