Expand replaces Widen: fill the window in both directions
From the development repository at 3f1da52. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
51e66db9a1
commit
cc0b8dbd31
9 files changed
+102
-72
No files matched your search
+30
-21
@@ -479,28 +479,37 @@ export class Session {
|
||||
}
|
||||
|
||||
/**
|
||||
* Make the sheet wider, for more room to write (Andy, 2026-10-08:
|
||||
* "Widen" enlarges the page rather than zooming). Everyone's page
|
||||
* widens; it is a change to the page, so it needs the right to make
|
||||
* pages, and it ends the chance to take back an image.
|
||||
* @param {number} width The page's new width, if wider than now.
|
||||
* @returns {boolean} Whether the page widened.
|
||||
* Make the sheet fill the window, for more room to write (Andy,
|
||||
* 2026-10-08 as "Widen", which only grew the width; both ways since
|
||||
* 2026-10-11, since there is no reason width alone suits anyone).
|
||||
* Everyone's page grows; it is a change to the page, so it needs the
|
||||
* right to make pages, and it ends the chance to take back an image.
|
||||
* @param {number} width The page's new width, if wider than now.
|
||||
* @param {number} height The page's new height, if taller than now.
|
||||
* @returns {boolean} Whether the page grew.
|
||||
*/
|
||||
widenPage(width) {
|
||||
expandPage(width, height) {
|
||||
const page = this.page;
|
||||
const added = Math.round(width) - page.width;
|
||||
if (!this.mayMakePages() || page.number === 0 || added <= 0) return false;
|
||||
// Equally on both sides of the PAGE as it is, writing included (the
|
||||
// sheet may lie inside a page that writing has grown; measured from
|
||||
// the sheet, the page came out short, Andy, 2026-10-08): what is on
|
||||
// the page stays where it is seen. The same whole number of units on
|
||||
// each side, since the page is centred on the screen: an odd growth
|
||||
// split 1199 and 1200 moved the page's centre half a unit, a fraction
|
||||
// of a pixel that showed as a one-pixel move on Olion (2026-10-09).
|
||||
const half = Math.floor(added / 2);
|
||||
if (half === 0) return false;
|
||||
page.baseLeft = page.left - half;
|
||||
page.baseWidth = page.width + 2 * half;
|
||||
if (!this.mayMakePages() || page.number === 0) return false;
|
||||
// Equally on both sides, and top and bottom, of the PAGE as it is,
|
||||
// writing included (the sheet may lie inside a page that writing has
|
||||
// grown; measured from the sheet, the page came out short, Andy,
|
||||
// 2026-10-08): what is on the page stays where it is seen. The same
|
||||
// whole number of units on each side, since the page is centred on
|
||||
// the screen: an odd growth split 1199 and 1200 moved the centre half
|
||||
// a unit, a pixel's fraction that showed as a one-pixel move on Olion
|
||||
// (2026-10-09). A dimension already filling the window does not grow.
|
||||
const addLeft = Math.floor((Math.round(width) - page.width) / 2);
|
||||
const addTop = Math.floor((Math.round(height) - page.height) / 2);
|
||||
if (addLeft <= 0 && addTop <= 0) return false;
|
||||
if (addLeft > 0) {
|
||||
page.baseLeft = page.left - addLeft;
|
||||
page.baseWidth = page.width + 2 * addLeft;
|
||||
}
|
||||
if (addTop > 0) {
|
||||
page.baseTop = page.top - addTop;
|
||||
page.baseHeight = page.height + 2 * addTop;
|
||||
}
|
||||
page.imagesRevision += 1;
|
||||
this.send(0, { type: 'page', page: page.descriptor() });
|
||||
this.extentChanged(true);
|
||||
@@ -510,7 +519,7 @@ export class Session {
|
||||
/**
|
||||
* Make the sheet the smallest that holds everything on the page with
|
||||
* the margin around it ("Shrink", Andy, 2026-10-08). A change to the
|
||||
* page like "Widen".
|
||||
* page like "Expand".
|
||||
* @returns {boolean} Whether the sheet changed.
|
||||
*/
|
||||
shrinkPage() {
|
||||
|
||||
Reference in new issue
Block a user