Compare commits

..

No commits in common. "d100153b2f805ad1488e6dea2dafef15f4325f7c" and "5553e89b1b49a76ef8448cf2b6761d5ae64a0cb6" have entirely different histories.

View file

@ -28,11 +28,11 @@
let stage: HTMLDivElement; let stage: HTMLDivElement;
const cssVars = pageCssVars(); const cssVars = pageCssVars();
// Background grid: one cell per active page, aligned to its edges (A4 at the origin if none). // Background grid: world-anchored, stepping up ×4 when zoomed out so lines never get denser than ~12px.
const grid = $derived.by(() => { const gridStep = $derived.by(() => {
const r = (doc.activeId && doc.rects.get(doc.activeId)) || { x: 0, y: 0, ...A4 }; let step = 24 * viewport.scale;
const s = viewport.scale; while (step < 12) step *= 4;
return { w: r.width * s, h: r.height * s, x: viewport.x + r.x * s, y: viewport.y + r.y * s }; return step;
}); });
// ---- autosave -------------------------------------------------------- // ---- autosave --------------------------------------------------------
@ -529,7 +529,7 @@
class:panning class:panning
class:erasing={tools.tool === 'eraser'} class:erasing={tools.tool === 'eraser'}
bind:this={stage} bind:this={stage}
style="background-size: {grid.w}px {grid.h}px; background-position: {grid.x}px {grid.y}px" style="--grid: {gridStep}px; background-position: {viewport.x}px {viewport.y}px"
onpointerdown={onPointerDown} onpointerdown={onPointerDown}
onpointermove={onPointerMove} onpointermove={onPointerMove}
onpointerup={onPointerUp} onpointerup={onPointerUp}
@ -672,6 +672,7 @@
background-image: background-image:
linear-gradient(to right, var(--grid-line) 1px, transparent 1px), linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px); linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
background-size: var(--grid) var(--grid);
} }
.stage :global(.cm-content) { .stage :global(.cm-content) {
user-select: text; user-select: text;