scrolling and size of canvas

This commit is contained in:
wkh
2026-09-09 23:13:46 +02:00
parent 1c5e57ceb4
commit a623adf9cc
3 changed files with 198 additions and 52 deletions
+15 -3
View File
@@ -31,13 +31,25 @@ const appearance = computed(() => {
});
const showGrid = computed(() => sheet.value.showGrid !== false);
/** Unscaled plane size: enclose every object with generous margin. */
/** Unscaled plane size: enclose every object with generous margin.
* A `fixed`-viewport table only ever occupies its own `view.width`/
* `view.height` on the canvas (that's the entire point of "feste Größe" --
* a bounded, internally-scrolling box) regardless of how many rows/cols it
* holds; only an `auto`-size table actually grows with its content, so only
* that case falls back to the row/col-count estimate. */
const plane = computed(() => {
let w = 1600;
let h = 1000;
for (const o of sheet.value.objects) {
const ow = o.kind === 'table' ? o.cols * 104 + 60 : o.width;
const oh = o.kind === 'table' ? o.rows * 28 + 60 : o.height;
let ow: number;
let oh: number;
if (o.kind === 'table' && o.view.mode === 'fixed') {
ow = o.view.width;
oh = o.view.height;
} else {
ow = o.kind === 'table' ? o.cols * 104 + 60 : o.width;
oh = o.kind === 'table' ? o.rows * 28 + 60 : o.height;
}
w = Math.max(w, o.x + ow + 500);
h = Math.max(h, o.y + oh + 400);
}