New pages inherit the size of the page they are created from

Blank pages added next to an existing page (via the "+" tile, Alt+Arrow
or the page menu) now copy that page's width and height, including
imported PDF pages, instead of always falling back to A4. The "+" preview
tile uses the same size so it matches the page it will create.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VsorPV3JeJRoZ1mD1pdvtL
This commit is contained in:
besbara 2026-09-26 19:55:24 +00:00
parent 0ad405c26e
commit fa2f491161
2 changed files with 4 additions and 4 deletions

View file

@ -15,7 +15,7 @@
import { dirName, displayName } from '$lib/storage/vault.svelte';
import { bounds, intersects, rectBeside, type Rect } from '$lib/model/layout';
import { canInsert, freeSlots, freeSlotsOf, neighbor, type Dir, type Slot } from '$lib/model/tree';
import { PAGE_PRESETS, type Stroke } from '$lib/model/types';
import { A4, PAGE_PRESETS, type Stroke } from '$lib/model/types';
import { PalmRejector } from '$lib/ink/palm';
import { StrokeRecorder, hitStroke } from '$lib/ink/stroke';
import { pageCssVars } from '$lib/editor/pageStyle';
@ -107,7 +107,7 @@
const a = doc.rectOf(slot.anchor);
if (!a) return null;
const page = doc.pages[slot.anchor];
const s = size ?? (page && !page.origin ? { width: page.width, height: page.height } : { width: 595.28, height: 841.89 });
const s = size ?? (page ? { width: page.width, height: page.height } : A4);
return rectBeside(a, slot.dir, s);
}