From d8c83c47f023a1d2feb4b0cbed70a85608e60740 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 30 Nov 2026 11:13:52 +0000 Subject: [PATCH] Fit: size PDFs with wider pages to the widest page (v63) In a PDF whose pages are not all the same width, Fit only used the first page's width. The check that should re-fit when a wider page's size loads compared that page with the widest page so far, but the page was already counted in "widest", so it was never wider and Fit never re-ran. Wider pages stuck out past the edge until the window was resized. Now the widest width is read before the page counts. Adds a test on the book PDF (page 11 is landscape). Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 2 ++ app/index.html | 4 ++-- app/report/index.html | 2 +- app/sw.js | 12 ++++++------ app/version.json | 2 +- app/viewer.js | 5 +++-- index.html | 2 +- overlay/ink_overlay.html | 2 +- tests/book.spec.js | 15 +++++++++++++++ 9 files changed, 32 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dd3109a..dad3b02 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +- **Fit works for PDFs with wider pages** (v63, PDF app). In a PDF whose pages are not all the same width, such as one with a landscape page, Fit now sizes the pages to the widest one as soon as it loads. Before, Fit only used the first page, so wider pages stuck out past the edge until the window was resized. + - **Tidier PDF app code, continued** (v62, PDF app). The split into smaller files continues. Nothing changes for teachers. - **Tidier PDF app code** (v61, PDF app). app/main.js is split into smaller files. Nothing changes for teachers. diff --git a/app/index.html b/app/index.html index aebb5be..f56ddf4 100644 --- a/app/index.html +++ b/app/index.html @@ -5,7 +5,7 @@ OverBoard PDF - + @@ -47,7 +47,7 @@

Open again

Your PDF and your ink stay in this browser on this computer. Nothing is uploaded. Have a Word file? In Word, choose File → Save as PDF, then drop the PDF here. Have an HTML worksheet? Drop it here to get a _board.html copy you can write on. -
About OverBoard · Board not working? · v62

+
About OverBoard · Board not working? · v63

diff --git a/app/report/index.html b/app/report/index.html index a892b57..3d6e134 100644 --- a/app/report/index.html +++ b/app/report/index.html @@ -98,7 +98,7 @@

Is OverBoard not working on your board?

If something doesn't work the way the page asks, that's fine. That's exactly what I need to know. Just keep going.

Nothing is sent until you press Send at the very end, and you'll see everything first. No worksheets, PDFs or ink are ever included.

-

OverBoard v62

+

OverBoard v63

diff --git a/app/sw.js b/app/sw.js index beaf794..1ac5f1f 100644 --- a/app/sw.js +++ b/app/sw.js @@ -1,7 +1,7 @@ // ===== GENERATED by tools/build.py: every file the app needs, with the start of its SHA-256. Do not edit by hand. ===== -const VERSION = '74fb2ffba32b'; +const VERSION = 'a96032eb2878'; const FILES = { - "../overlay/ink_overlay.html": "cf491197d61d3324", + "../overlay/ink_overlay.html": "f5e2326731a7644a", "../shared/ink-core.js": "b65c19035e241559", "../shared/strings.js": "f2394bc536e6ec28", "../shared/toolbar.css": "e1e1905491edf8e6", @@ -19,7 +19,7 @@ const FILES = { "icons/icon-512.png": "46ca8bd2d6a32612", "icons/maskable-512.png": "c7d41ed2fa4ad874", "image.js": "a867d49b8c47a4a0", - "index.html": "0a9c3158b886f378", + "index.html": "2d124b7152085b15", "ink.js": "bec7069546fba2b6", "libs.js": "3b92080779974cfa", "main.js": "93f650a3e65a5b68", @@ -30,7 +30,7 @@ const FILES = { "offline.js": "e620a1ba2b6ea506", "open.js": "406132fc612f21db", "page-view.js": "30953dacd7f8594a", - "report/index.html": "78fcc108b971b965", + "report/index.html": "9232710e3f70a891", "saving.js": "92749eb3940b545b", "settings.js": "0502541890fcab28", "start-screen.js": "3ef08c834bbe0eaf", @@ -229,8 +229,8 @@ const FILES = { "vendor/pdfjs-dist@4.10.38/standard_fonts/LiberationSans-BoldItalic.ttf": "a224075ac17495ad", "vendor/pdfjs-dist@4.10.38/standard_fonts/LiberationSans-Italic.ttf": "832b4406dbef2362", "vendor/pdfjs-dist@4.10.38/standard_fonts/LiberationSans-Regular.ttf": "f8ace1f892b2bd9d", - "version.json": "17ab852797ce4bb1", - "viewer.js": "f1e96f64aec11170" + "version.json": "31f18c7184e8a89e", + "viewer.js": "1c4e8693868f12d9" }; // ===== END GENERATED ===== diff --git a/app/version.json b/app/version.json index 55becd2..43695e6 100644 --- a/app/version.json +++ b/app/version.json @@ -1,5 +1,5 @@ { - "v": "5959bb0b7628", + "v": "5914fcb94a9e", "js": [ "core.js", "embed.js", diff --git a/app/viewer.js b/app/viewer.js index 6545ad1..91a5223 100644 --- a/app/viewer.js +++ b/app/viewer.js @@ -113,14 +113,15 @@ export class Viewer { continue; } if (gen !== this.gen) return; - const P = this.pages[n - 1]; + const P = this.pages[n - 1], + widest = this.maxW; // before this page counts, so a wider page re-fits below P.sized = true; P.turn = this.turnOf(n); if (Math.abs(vp.width - P.w) > 0.01 || Math.abs(vp.height - P.h) > 0.01) { P.w = vp.width; P.h = vp.height; this.sizePage(P); - if (this.fit && P.w > this.maxW) this.layout(); + if (this.fit && P.w > widest) this.layout(); } } } diff --git a/index.html b/index.html index 321a630..d71ee08 100644 --- a/index.html +++ b/index.html @@ -58,7 +58,7 @@

Exit ticket

OverBoard · page 2 / 2 · Your ink saves in this browser only. Nothing is uploaded.
-