Highlights landed on the right line but shifted right and oversized on any display with devicePixelRatio != 1. Cause: selection fractions divided the textLayer span rects by documentElement's screen rect, but pdf.js scales the iframe's <html> by 1/dpr — that rect is dpr× smaller than the visible page, inflating every x/w fraction by dpr (on a 2× display a highlight started twice as far right and was twice as wide). dpr=1 displays were coincidentally correct, which is why the geometry looked sound when written. The denominator is now the rendered canvas (#canvas canvas), whose post-transform rect IS the visible page and shares the textLayer's transform space — the dpr scaling cancels exactly. Comics keep the img denominator; a viewport fallback covers any page without either. The popover-placement scale factors (frame/denominator) become 1 for PDFs as a side effect, fixing popover drift too. The fork's click hit-test (86e234d) gets the same canvas-aware denominator so clicking highlights opens the editor at the right spot. Highlights saved before this fix stored dpr-inflated fractions and will still render misplaced — delete and re-create them.
31 lines
1.2 KiB
JSON
31 lines
1.2 KiB
JSON
{
|
|
"name": "bookhoard",
|
|
"version": "1.0.0",
|
|
"description": "A self-hosted ebook management system",
|
|
"scripts": {
|
|
"build:css": "tailwindcss -i ./web/static/input.css -o ./web/static/style.css --watch",
|
|
"build:css:prod": "tailwindcss -i ./web/static/input.css -o ./web/static/style.css --minify",
|
|
"build:ts": "cp node_modules/htmx.org/dist/htmx.min.js web/static/htmx.min.js && vite build",
|
|
"build:ts:dev": "cp node_modules/htmx.org/dist/htmx.min.js web/static/htmx.min.js && vite build --mode development",
|
|
"build:ts:watch": "cp node_modules/htmx.org/dist/htmx.min.js web/static/htmx.min.js && vite build --watch",
|
|
"build": "npm run build:ts && npm run build:css:prod",
|
|
"dev": "npm run build:ts:dev && npm run build:css"
|
|
},
|
|
"dependencies": {
|
|
"@bookhoard/foliate-js": "git+https://github.com/john-okeefe/foliate-js.git#86e234d",
|
|
"alpinejs": "^3.15.8",
|
|
"chart.js": "^4.5.1",
|
|
"highlight.js": "^11.11.1",
|
|
"htmx.org": "^2.0.8",
|
|
"lunr": "^2.3.9"
|
|
},
|
|
"devDependencies": {
|
|
"@tailwindcss/forms": "^0.5.11",
|
|
"@tailwindcss/typography": "^0.5.19",
|
|
"autoprefixer": "^10.4.27",
|
|
"tailwindcss": "^3.4.19",
|
|
"typescript": "^5.9.3",
|
|
"vite": "^7.3.1"
|
|
}
|
|
}
|