fix(web): PDF rect-edge adjust — a start-edge drag pins the far edge
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.
This commit is contained in:
1 parent
4d1fb05e49
commit
361fdaab39
1 file changed
+10
-2
@@ -1896,7 +1896,12 @@ document.addEventListener("alpine:init", () => {
|
|||||||
}
|
}
|
||||||
if (best === null) return;
|
if (best === null) return;
|
||||||
if (isStart) {
|
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 {
|
} else {
|
||||||
r[2] = Math.min(Math.max(best - r[0], MIN), 1 - r[0]);
|
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") {
|
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 {
|
} else {
|
||||||
r[3] = Math.min(Math.max(best - r[1], MIN), 1 - r[1]);
|
r[3] = Math.min(Math.max(best - r[1], MIN), 1 - r[1]);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user