diff --git a/src/lib/components/CanvasView.svelte b/src/lib/components/CanvasView.svelte index 35ad5a6..ad72c68 100644 --- a/src/lib/components/CanvasView.svelte +++ b/src/lib/components/CanvasView.svelte @@ -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); } diff --git a/src/lib/state/doc.svelte.ts b/src/lib/state/doc.svelte.ts index 53900df..4780fa2 100644 --- a/src/lib/state/doc.svelte.ts +++ b/src/lib/state/doc.svelte.ts @@ -161,8 +161,8 @@ export class CanvasDoc { addBlankPage(anchor: string, dir: Dir): string | null { const a = this.pages[anchor]; - // New pages default to A4, oriented like their neighbour when it's a plain page. - const size = a && !a.origin && a.width > a.height ? { width: A4.height, height: A4.width } : A4; + // New pages inherit the size of the page they grow from (A4 if it's missing). + const size = a ? { width: a.width, height: a.height } : A4; const id = newId(); return this.insertPages(anchor, dir, [{ id, ...size, markdown: '', strokes: [] }]) ? id : null; }