Commit Graph
18 Commits
Author SHA1 Message Date
john-okeefe d0654951b5 Expose the PDF.js document proxy on the book object
book.pdf lets the host drive pdf.js directly (page.getTextContent
for in-book search) without reaching into renderer internals.
2026-08-17 08:02:01 -04:00
john-okeefe e9e61d885b Touch gestures for fixed-layout: pinch-zoom, pan, swipe paging, double-tap
- Single finger: pan while zoomed; horizontal swipe pages at fit
  (direction mapped through next()/prev() so RTL manga reads
  correctly); drag on PDF text still defers to selection via the
  existing smart-detection (realTarget).
- Two fingers: pinch-zoom around the midpoint (through the shared
  zoom machinery, so PDF re-render scheduling works) plus
  midpoint-pan; lifts back to single-finger pan when one lifts.
- Double-tap: zoom 2.5x at the point / reset to fit.
- Touch events forwarded from page iframes with converted
  coordinates; preventDefault only when the engine actually consumes
  the gesture so native selection/taps stay intact.
- touch-action: none on :host and in comic/pdf page documents so the
  browser does not fight the gesture engine inside iframes.
2026-08-14 15:54:00 -04:00
john-okeefe eb9ae699d7 Restore config.pdfjsPath override and options plumbing
Reverts the pdf.js/view.js API change that removed the exported
'config' (pdfjsPath) and the makePDF/open options parameter.
bookhoard overrides config.pdfjsPath to point at its own served
/static/vendor/pdfjs/ assets, so the override + options must stay.
Keep the unrelated external-link href fix in view.js.
2026-08-13 12:43:56 -04:00
john-okeefe d016b27752 Fix PDF.js vendor path glob and reformat with consistent style
- Change pdfjsPath template from 'vendor/pdfjs/' to
  './vendor/pdfjs/' so the relative glob resolves correctly
  when the module is bundled with Vite
- Reformat entire file: 2-space indentation, double quotes, semicolons,
  trailing commas, parenthesized arrow function parameters, and aligned
  multi-line call arguments for consistency with the rest of the codebase
2026-04-22 16:28:36 -04:00
John Factotum 1217096245 Update PDF.js to 5.5.207
Fixes https://github.com/johnfactotum/foliate-js/issues/85
2026-03-05 15:52:38 +08:00
John Factotum 519c0329b2 PDF: improve metadata 2024-10-18 13:42:49 +08:00
Huang Xin f24e611c4e Lazy loading of PDF documents (#37) (#38) 2024-10-18 04:05:31 +00:00
John Factotum 4cd2ca2eb3 PDF: fix comment 2024-09-28 19:32:14 +08:00
John Factotum 3409674e66 PDF: set isEvalSupported to false
`eval()` would be blocked by CSP and thus not supported
2024-09-28 19:17:12 +08:00
John Factotum 45d67a0db3 PDF: add CMaps and fonts 2024-09-28 17:41:38 +08:00
John Factotum be76724699 PDF: fix text selection 2024-09-28 17:38:59 +08:00
John Factotum 693341f008 PDF: fix links 2024-09-28 14:29:47 +08:00
John Factotum 1e952102bd PDF: rerender when scale changes
The fixed-layout renderer now accepts an object for the return value of
`load()` (on the `book.sections` items). If it's an object, the `src`
is the URL of the section, and `onZoom`, if present, will be called
when the viewport is zoomed. With this you can scale the page yourself
rather than relying on the renderer's own scaling with CSS transform.

Also upgraded to PDF.js 4.6.82. And now internal links are broken...
Don't know how to fix that yet.
2024-09-28 12:12:59 +08:00
Kian-Meng Ang 42ebb0aec4 Fix typos (#34)
Found via `typos --hidden --format brief`
2024-09-23 08:29:28 +00:00
John Factotum 37626ba44a PDF: default to odd pages right 2024-06-22 01:40:58 +08:00
Vytor Rennan 28a757e5bb Fix bad resolution for pdfs (#23) 2024-04-26 03:52:21 +00:00
John Factotum 4f321563c7 PDF: add annotation layer and handle links 2023-10-09 01:56:13 +08:00
John Factotum a63a68eda0 Add PDF support 2023-10-08 21:27:06 +08:00