fix(reader): PDF highlights never appeared — isPDF read too early + overlay shrunk by pdf.js transform
Two bugs broke the Phase 3b PDF highlight flow end to end: 1. Selection capture never attached: reader.ts read renderer.isPDF before view.init() rendered the first spread, but the renderer only sets that flag once frames exist (PDF frames carry pdf.js onZoom). The stale undefined copy gated the pointerup selection listener off, so selecting PDF text did nothing. The listener now gates structurally on the loaded document having a .textLayer (true for every PDF page, false for comics), and isPDF is re-read after init — which also finally makes the Smart|Pan|Text control and the saved pointer mode apply on PDFs. 2. Highlights rendered invisibly: the overlay SVG lived inside the page iframe, whose <html> pdf.js scales by 1/devicePixelRatio — shrinking the overlay into the top-left corner on any dpr != 1 display. The fork (1c0ebf3) now renders annotation rects host-side, inside the frame wrapper element, positioned in percentages of the visible page box — immune to the html transform, zoom re-renders, comic iframe scaling, and pan/zoom.
This commit is contained in:
+1
-1
@@ -12,7 +12,7 @@
|
||||
"dev": "npm run build:ts:dev && npm run build:css"
|
||||
},
|
||||
"dependencies": {
|
||||
"@bookhoard/foliate-js": "git+https://github.com/john-okeefe/foliate-js.git#aba68d8",
|
||||
"@bookhoard/foliate-js": "git+https://github.com/john-okeefe/foliate-js.git#1c0ebf3",
|
||||
"alpinejs": "^3.15.8",
|
||||
"chart.js": "^4.5.1",
|
||||
"highlight.js": "^11.11.1",
|
||||
|
||||
Reference in New Issue
Block a user