16 Commits
Author SHA1 Message Date
john-okeefe 170352bc71 Fix interaction-mode toggle default icon and tooltip
The toggle button was defaulting to 'Pan Mode' with a plus-icon path,
but the actual default interaction mode is 'select' (the cursor/arrow).
Update the tooltip to 'Select Mode' and replace the SVG path with an
arrow/cursor shape so the icon matches the active mode at startup.
2026-04-18 22:32:44 -04:00
john-okeefe d5b2e3deda Add magnifier, interaction mode toggle, and zoom percentage display
Magnifier (fixed-layout.js):
- Rewrite magnifier to use CSS background-image for comics (blob URLs
  from iframe img elements) and canvas drawImage for PDFs. Replaces
  broken iframe.cloneNode approach that created empty sandboxed clones.
- Detect which iframe is under the cursor by checking bounding rects,
  so magnifier works on both left and right panes.
- Forward mousemove events from iframe documents to handleMagnifierMove
  so the magnifier follows the cursor inside iframes.
- Add background-repeat: no-repeat to lens styles.
- Add zoomMagnifierEnabled getter for external state checks.

Interaction mode toggle (PDF only):
- Add 'interaction-mode' observed attribute with 'select'/'pan' values.
- In select mode (default for PDFs): mouse events pass through for text
  selection; Shift+drag enables panning as a fallback.
- In pan mode: drag-to-pan works as normal.
- Comic books always use pan mode (no text to select).
- Auto-detect PDF via #isPDF flag set in #showSpread from onZoom presence.
- Add isPDF getter so reader.js can show/hide the toggle button.
- Add toggle button in reader.html, hidden by default, shown for PDFs
  via the view 'load' event.
- Escape key dismisses the magnifier.

Zoom percentage display (reader.js):
- Dispatch 'zoom' CustomEvent from #zoomByRatio with the new scale.
- Listener in reader.js updates the percentage display on scroll zoom.

Also includes minor formatting (line wrapping) in #goLeft/#goRight.
2026-04-18 00:39:15 -04:00
john-okeefe 3f9ab7528b Implement zoom control functionality for fixed-layout e-books
This commit adds comprehensive zoom control capabilities for fixed-layout
e-book content, allowing users to zoom in, out, and reset zoom levels for
better readability and content inspection.

Key features added:
- Zoom control UI with +/- buttons and percentage display
- Keyboard shortcuts for zoom operations (Ctrl/Cmd +, -, 0)
- Mouse wheel zoom with Ctrl/Cmd modifier key
- Drag-to-pan functionality when zoomed in
- Smooth zoom transitions and state management
- Zoom constraints (min/max limits) to prevent over-zooming

Changes include:
- FixedLayout: Enhanced with zoom state management, drag handlers,
  and keyboard/mouse event listeners for intuitive zoom control
- Reader UI: Added zoom control toolbar with visual feedback
- FixedLayout renderer integration with reader zoom controls

The zoom controls provide a seamless experience for users who need to
examine fixed-layout content more closely or adjust content size for
their preferred reading experience.
2026-04-16 21:37:54 -04: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
John Factotum a63a68eda0 Add PDF support 2023-10-08 21:27:06 +08:00
John Factotum 6f6f6b4969 Remove nonexistent scripts
Should have been removed after 9949000a9e
2023-05-15 14:50:54 +08:00
John Factotum 514cb81fe6 Reader: allow loading files from URL parameter
Fixes #3
2023-03-15 11:00:21 +08:00
John Factotum 2c452719d0 Paginator: add option for maximum number of columns
Also: allow it to be positioned relative to the parent
2023-03-09 23:36:20 +08:00
John Factotum 602c8381c2 Add support for <object>
It's sometimes used for SVGs
2022-10-27 18:11:21 +00:00
John Factotum 21bf6499a4 Reader: add progress slider 2022-10-22 18:29:52 +00:00
John Factotum 3c05d0a957 Reader: add footnote popovers
Lacks a "go to" button, but at least shows something instead of nothing
2022-10-21 18:57:26 +00:00
John Factotum f39d74f932 Reader: add layout option 2022-10-21 09:53:00 +00:00
John Factotum fea239a111 Reader: show cover, title, and author in sidebar 2022-10-20 18:16:44 +00:00
John Factotum 84691787fa Reader: add title and file chooser button 2022-10-20 14:28:42 +00:00
John Factotum 9a2bb558fd Reader: add sidebar and TOC 2022-10-20 12:50:37 +00:00
John Factotum d0cd085a22 Add sample reader 2022-10-19 11:04:43 +00:00