commit e2fcd8922cdd9f7098382669f956645266cc80e8
parent 2e9d25bd3e886094395259ee5d3d480665d8509f
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Tue, 10 Nov 2026 09:52:53 -0500
umtool: a stacked panel cell is drawn a size down (to 0.8 of its column, its aspect kept) before it is left out; the tally's row 72 px
vertical-deck.spec found it: with a tally the trail had no room beside the dial and was left out.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
2 files changed, 28 insertions(+), 7 deletions(-)
diff --git a/umtool/report-to-video/vertical-deck.mjs b/umtool/report-to-video/vertical-deck.mjs
@@ -54,6 +54,9 @@ export const STACKED_CAPTION_SHARE = 0.046;
export const STACKED_QR_SHARE = 0.13;
export const STACKED_QR_SMALL_SHARE = 0.1;
+/** The smallest a panel cell is drawn against its column's width (its aspect kept) before it is left out. */
+export const PANEL_SHRINK = 0.8;
+
/** The panel's gap between its two columns and between its cells, a share of the width. */
export const STACKED_GAP_SHARE = 0.02;
@@ -106,7 +109,7 @@ export function stackedGeometry(render, { counter = false } = {}) {
const sq = { x: a.x0, y: source.y + padTop, size: qrSize };
const sourceBlock = { ...source, qr: sq, text: { x: sq.x + qrSize + Math.round(27 * u), y: sq.y, width: a.x1 - (sq.x + qrSize + Math.round(27 * u)), height: qrSize } };
// The tally's row, over the source block.
- const counters = counter ? { x: a.x0, y: source.y - gap - Math.round(80 * u), width: a.x1 - a.x0, height: Math.round(80 * u) } : null;
+ const counters = counter ? { x: a.x0, y: source.y - gap - Math.round(72 * u), width: a.x1 - a.x0, height: Math.round(72 * u) } : null;
// The panel: what is left between the captions and the counters (or the source block).
const panelTop = captions.y + captions.height + Math.round(15 * u);
const panelBottom = (counters ? counters.y : source.y) - gap;
@@ -170,15 +173,24 @@ export function panelCells(panel, items, gap) {
tallDone = true;
continue;
}
- const h = evenDown(colW / Math.max(0.2, it.aspect));
- // The column with the most room left that holds it.
- const fits = cols.filter((c) => c.y + h <= bottom + 0.5).sort((p, q) => p.y - q.y || p.x - q.x);
- if (!fits.length || h < 24) {
+ // At its column's width, else a size down (to PANEL_SHRINK of it, its aspect kept) where that fits.
+ let placed = null;
+ for (const k of [1, 0.95, 0.9, 0.85, PANEL_SHRINK]) {
+ const w = evenDown(colW * k);
+ const h = evenDown(w / Math.max(0.2, it.aspect));
+ // The column with the most room left that holds it.
+ const fits = cols.filter((c) => c.y + h <= bottom + 0.5).sort((p, q) => p.y - q.y || p.x - q.x);
+ if (fits.length && h >= 24) {
+ placed = { c: fits[0], w, h };
+ break;
+ }
+ }
+ if (!placed) {
out.push(it.id);
continue;
}
- const c = fits[0];
- cells[it.id] = { x: c.x, y: c.y, width: colW, height: h };
+ const { c, w, h } = placed;
+ cells[it.id] = { x: c.x, y: c.y, width: w, height: h };
c.y += h + gap;
}
return { cells, out };
diff --git a/umtool/report-to-video/vertical-deck.test.mjs b/umtool/report-to-video/vertical-deck.test.mjs
@@ -316,3 +316,12 @@ test("a stacked vertical deck's render declares at least its measured peak + mar
assert.ok(one(v) >= VERTICAL_DECK_MIN_MB);
assert.equal(one({ ...v, vertical: { deck: "bare" } }), one({ chrome: v.chrome }));
});
+
+test("with the tally's row the dial, the odometer and the trail still stand in the panel (a cell a size down, never squashed)", () => {
+ const r = verticalRender({ ...landscape({ dial: true, odometer: true, trail: true }), format: "vertical", chrome: { ...DECK, deck: { dial: true, odometer: true, trail: true }, factcheck: {} } });
+ const ig = instrumentsGeometry(r);
+ assert.deepEqual(ig.out, []);
+ for (const n of ["dial", "odometer", "trail"]) assert.ok(ig[n], n);
+ assert.ok(Math.abs(ig.trail.width / ig.trail.height - 600 / 138) < 0.1);
+ assert.ok(ig.trail.y + ig.trail.height <= ig.column.y + ig.column.height);
+});