UNPKG

@pdf-viewer/react

Version:

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

16 lines (15 loc) 530 B
const d = (e, t, o) => e * o + t + 1, a = (e, t) => { const o = e - 1, n = Math.floor(o / t), s = (o - n * t) % t; return { rowIndex: n, columnIndex: s }; }, h = (e, t) => { const o = [], n = []; return e.heights.forEach((s, c) => { const r = a(c + 1, t), i = e.widths[c]; o[r.rowIndex] = Math.max(o[r.rowIndex] || 0, s), n[r.columnIndex] = Math.max(n[r.columnIndex] || 0, i); }), { rowsHeight: o, columnsWidth: n }; }; export { h as getGridDimension, d as getPageFromPosition, a as getPositionFromPage };