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]); }