From 361fdaab39c5451ac4370d52a35b34e2b6a55834 Mon Sep 17 00:00:00 2001 From: John O'Keefe Date: Sat, 10 Oct 2026 11:47:41 -0400 Subject: [PATCH] =?UTF-8?q?fix(web):=20PDF=20rect-edge=20adjust=20?= =?UTF-8?q?=E2=80=94=20a=20start-edge=20drag=20pins=20the=20far=20edge?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The left-edge drag kept the rect width instead of anchoring the opposite edge, so shrinking from the left silently dragged the right edge along and the recomputed text grew words at the far end (found by the Android device test of the app leg). Same fix for the top edge / bottom pin. The end-edge branches were already correct. --- web/src/reader/reader.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/web/src/reader/reader.ts b/web/src/reader/reader.ts index 49bdd18b..a64e2e1d 100644 --- a/web/src/reader/reader.ts +++ b/web/src/reader/reader.ts @@ -1896,7 +1896,12 @@ document.addEventListener("alpine:init", () => { } if (best === null) return; if (isStart) { - r[0] = Math.min(Math.max(best, 0), r[0] + r[2] - MIN); + // A start-edge drag pins the FAR edge: shrink the size by the + // same amount the left moves (keeping the size would drag the + // rect's right edge along — found by device test). + const far = r[0] + r[2]; + r[0] = Math.min(Math.max(best, 0), far - MIN); + r[2] = far - r[0]; } else { r[2] = Math.min(Math.max(best - r[0], MIN), 1 - r[0]); } @@ -1913,7 +1918,10 @@ document.addEventListener("alpine:init", () => { } } if (grab.edge === "top") { - r[1] = Math.min(Math.max(best, 0), r[1] + r[3] - MIN); + // Mirror of the left edge: a top-edge drag pins the bottom. + const bottom = r[1] + r[3]; + r[1] = Math.min(Math.max(best, 0), bottom - MIN); + r[3] = bottom - r[1]; } else { r[3] = Math.min(Math.max(best - r[1], MIN), 1 - r[1]); }