commit 7e7ce7f34e59f12e640a0194d7b40f1897cb5e4b
parent 6c92066953222ff946a9d26489ace951256264b9
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Fri, 6 Nov 2026 04:11:00 -0500
umtool: a lower chapter band never covers a post item's card
At 9:41 in rev9-a-full the "lower" bumper of the section that opens on x01
("23 OCT 2026 / The scale video / 23 Oct - 3 Nov 2026") printed across the
post card's last line and footer. chapterPlacement (chrome-story.mjs) now
decides where each bumper stands:
- band: the lower band at the footage box's foot, as always, when no post
card (schedule.covers) under its window touches it;
- side: over a post item whose card it would touch, the band stands in the
card's wider free side margin (the footage box's height, 16 px from the
card), its words fitted to that width (scaled down until each line's
longest word fits, 0.45 at least, then wrapped) and set to its foot;
- none: when neither margin is CHAPTER_SIDE_MIN (180 design px) wide, there
is no bumper over that card -- the rail's section label and the section
title still mark where it opens;
- card style is unchanged (it covers the footage box by design).
The measure extras dodge where it stands (measureCovers), not the band it
left. Documented in the chapter module's docs (knobs.md regenerated); a test
with a section that opens on a post item.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
5 files changed, 106 insertions(+), 12 deletions(-)
diff --git a/umtool/docs/knobs.md b/umtool/docs/knobs.md
@@ -1850,7 +1850,7 @@ A section bumper -- per dog, per crisis, per lawsuit -- over the first `seconds`
| Knob | Range · default | From a terminal |
|---|---|---|
| `chrome.chapter.list[]` | 1–40 `{at, title ≤48, subtitle? ≤90, date?}` -- `at` the clip it opens, once each | `umtool modules apply <p> --config module-config.json` · `umtool look <p> chapter='{…}'` |
-| `chrome.chapter.style` | `card` (the footage box covered) · `lower` (a band at its foot) · default `card` | `umtool look <p> chapter.style=lower` |
+| `chrome.chapter.style` | `card` (the footage box covered) · `lower` (a band at its foot -- except over a POST item, whose card it never covers: it stands in the card's wider free side margin, its words fitted to it; a card with no margin 180 px wide gets no bumper, the rail's section label still marks it) · default `card` | `umtool look <p> chapter.style=lower` |
| `chrome.chapter.seconds` | 1–8 s, never past the clip · default 3 | `umtool look <p> chapter.seconds=2.5` |
### Finale
diff --git a/umtool/report-to-video/chrome-story.mjs b/umtool/report-to-video/chrome-story.mjs
@@ -196,11 +196,52 @@ export function chapterWindows(schedule, render) {
if (!sp) return;
const to = Math.min(sp.out, sp.in + C.seconds);
if (!(to - sp.in > 0.2)) return;
- out.push({ segment: c.at, from: sp.in, to, n, title: c.title, subtitle: c.subtitle ?? "", date: c.date ?? null });
+ const w = { segment: c.at, from: sp.in, to, n, title: c.title, subtitle: c.subtitle ?? "", date: c.date ?? null };
+ // Where it stands (chapterPlacement): a lower band that would cover a post card moves into the card's free side
+ // margin -- or, where neither margin can hold it, the cut has no bumper over that card.
+ const place = chapterPlacement(schedule, render, w);
+ if (place.mode === "none") return;
+ out.push({ ...w, place });
});
return out;
}
+/** The narrowest free margin beside a post card a lower chapter band moves into, design px (1920 wide). */
+export const CHAPTER_SIDE_MIN = 180;
+
+/**
+ * Where chapter window `w` stands, in frame px: `{ mode, rect, side? }`.
+ *
+ * - `card` (style card): the whole footage box -- a bumper that covers by design.
+ * - `band` (style lower): the band across the footage box's foot, as always.
+ * - `side`: a lower band whose window falls on a POST item (schedule.covers) and
+ * would touch its card stands instead in the card's wider free side margin
+ * (`side` "left" | "right": the footage box's height, a 16 px gap from the
+ * card), its words fitted to that width and set to its foot. The card stays
+ * whole: the post item's words are the evidence on screen.
+ * - `none`: neither margin is CHAPTER_SIDE_MIN wide -- no bumper over that card
+ * (the rail's section label and the section title still mark where it opens).
+ */
+export function chapterPlacement(schedule, render, w) {
+ const feed = schedule?.layout === "feed";
+ const f = chapterGeometry(render, { feed });
+ if (resolveChapter(render).style !== "lower") return { mode: "card", rect: { ...f } };
+ const band = chapterCover(render, { feed });
+ const covers = (Array.isArray(schedule?.covers) ? schedule.covers : [])
+ .filter((c) => Array.isArray(c?.rects) && c.rects.length && c.from < w.to && c.to > w.from);
+ const rects = covers.flatMap((c) => c.rects).filter((r) => r && [r.x, r.y, r.width, r.height].every(Number.isFinite));
+ const touches = (a, b) => a.x < b.x + b.width && b.x < a.x + a.width && a.y < b.y + b.height && b.y < a.y + a.height;
+ if (!rects.some((r) => touches(r, band))) return { mode: "band", rect: band };
+ const px = pxOf(render);
+ const gap = px(16);
+ const x0 = Math.min(...rects.map((r) => r.x)), x1 = Math.max(...rects.map((r) => r.x + r.width));
+ const left = { x: f.x, y: f.y, width: Math.max(0, x0 - gap - f.x), height: f.height };
+ const right = { x: x1 + gap, y: f.y, width: Math.max(0, f.x + f.width - (x1 + gap)), height: f.height };
+ const [side, rect] = left.width >= right.width ? ["left", left] : ["right", right];
+ if (rect.width < px(CHAPTER_SIDE_MIN)) return { mode: "none", rect: null };
+ return { mode: "side", side, rect };
+}
+
/** The chapter bumper's region: the footage box. */
export function chapterGeometry(render, { feed = false } = {}) {
return footageBox(render, { feed });
@@ -237,18 +278,33 @@ export function chapterHtml(schedule, render, window, opts = {}) {
const { init, cues } = compileCues({ ch: { autoAlpha: 0 }, "ch.t": { y: px(18) } }, ev);
const lower = C.style === "lower";
const date = ch.date ? dateText(ch.date) : "";
+ // Beside a post card (chapterPlacement "side"): the band in the card's free margin, its words fitted to it --
+ // scaled down until the longest word of each line fits the margin's width, then wrapped.
+ const side = ch.place?.mode === "side" ? ch.place : null;
+ let k = 1;
+ if (side) {
+ const room = side.rect.width - 2 * px(20);
+ const longest = (text, em) => Math.max(0, ...String(text ?? "").split(/\s+/).map((wd) => wd.length * em));
+ const need = Math.max(longest(ch.title, 0.58) * px(54), longest(ch.subtitle, 0.52) * px(28), longest(date, 0.74) * px(26), 1);
+ k = Math.max(0.45, Math.min(1, room / need));
+ }
+ const fs = (v) => Math.max(1, Math.round(px(v) * k));
const css = `
.chapter { position: absolute; visibility: hidden; opacity: 0; display: flex; flex-direction: column;
- ${lower
+ ${side
+ ? `left: ${side.rect.x - geo.x}px; top: ${side.rect.y - geo.y}px; width: ${side.rect.width}px; height: ${side.rect.height}px; box-sizing: border-box;
+ padding: ${px(26)}px ${px(20)}px; justify-content: flex-end; ${side.side === "right" ? "text-align: right; align-items: flex-end;" : ""}
+ background: linear-gradient(to top, ${rgba(pal.bg, 0.94)}, ${rgba(pal.bg, 0.0)} 60%);`
+ : lower
? `left: 0; right: 0; bottom: 0; height: ${px(CHAPTER_LOWER_HEIGHT)}px; padding: ${px(26)}px ${px(48)}px; justify-content: center;
background: linear-gradient(to top, ${rgba(pal.bg, 0.94)}, ${rgba(pal.bg, 0.0)});`
: `inset: 0; align-items: center; justify-content: center; text-align: center; padding: ${px(60)}px;
background: ${rgba(pal.bg, 0.92)};`} }
- .ct { display: flex; flex-direction: column; gap: ${px(12)}px; ${lower ? "" : "align-items: center;"} }
- .rule { width: ${px(96)}px; height: ${px(6)}px; background: ${pal.accent}; border-radius: ${px(3)}px; }
- .title { font-family: 'DeckSansBold', sans-serif; font-size: ${px(lower ? 54 : 84)}px; line-height: 1.08; color: ${pal.fg}; }
- .sub { font-size: ${px(lower ? 28 : 36)}px; line-height: 1.25; color: ${pal.muted}; max-width: ${px(1300)}px; }
- .date { font-family: 'DeckSansBold', sans-serif; font-size: ${px(26)}px; letter-spacing: 0.12em; text-transform: uppercase; color: ${pal.accent}; }`;
+ .ct { display: flex; flex-direction: column; gap: ${fs(12)}px; ${lower ? (side?.side === "right" ? "align-items: flex-end;" : "") : "align-items: center;"} }
+ .rule { width: ${fs(96)}px; height: ${px(6)}px; background: ${pal.accent}; border-radius: ${px(3)}px; }
+ .title { font-family: 'DeckSansBold', sans-serif; font-size: ${lower ? fs(54) : px(84)}px; line-height: 1.08; color: ${pal.fg}; }
+ .sub { font-size: ${lower ? fs(28) : px(36)}px; line-height: 1.25; color: ${pal.muted}; max-width: ${px(1300)}px; }
+ .date { font-family: 'DeckSansBold', sans-serif; font-size: ${fs(26)}px; letter-spacing: 0.12em; text-transform: uppercase; color: ${pal.accent}; }`;
const body = `<div class="chapter" data-k="ch"><div class="ct" data-k="ch.t"><div class="rule"></div>${date ? `<div class="date">${esc(date)}</div>` : ""}<div class="title">${esc(ch.title)}</div>${ch.subtitle ? `<div class="sub">${esc(ch.subtitle)}</div>` : ""}</div></div>`;
return cuePageHtml({
id: "chapter", W: geo.width, H: geo.height, fps, fonts: opts.fonts, gsapSrc: opts.gsap, css, body, init, cues,
diff --git a/umtool/report-to-video/measure-extras.mjs b/umtool/report-to-video/measure-extras.mjs
@@ -837,7 +837,8 @@ export function measureCovers(schedule, render) {
const chapters = render?.chrome?.chapter ? chapterWindows(schedule, render) : [];
if (chapters.length) {
const band = chapterCover(render, { feed });
- for (const w of chapters) out.push({ kind: "chapter", from: w.from, to: w.to, rects: [band] });
+ // Where each bumper stands: its band, or beside a post card its side margin (chrome-story.mjs chapterPlacement).
+ for (const w of chapters) out.push({ kind: "chapter", from: w.from, to: w.to, rects: [w.place?.mode === "side" ? w.place.rect : band] });
}
return out.sort((a, b) => a.from - b.from);
}
diff --git a/umtool/report-to-video/modules/chapter.mjs b/umtool/report-to-video/modules/chapter.mjs
@@ -5,7 +5,7 @@
import path from "node:path";
import { snapWindow } from "../deck.mjs";
-import { chapterGeometry, chapterHtml, chapterWindows, resolveChapter } from "../chrome-story.mjs";
+import { CHAPTER_SIDE_MIN, chapterGeometry, chapterHtml, chapterWindows, resolveChapter } from "../chrome-story.mjs";
import { assertRegion, defineModule } from "./contract.mjs";
import { CHAPTER_DEFAULTS, CHAPTER_LIMITS, CHAPTER_STYLES, validateChapter } from "./story-settings.mjs";
@@ -38,7 +38,7 @@ export default defineModule({
intro: "A section bumper -- per dog, per crisis, per lawsuit -- over the first `seconds` of the clip it opens (`render.chrome.chapter`, chrome-story.mjs): a window of the cut laid at its own second, over the footage box (the deck stays). It does not insert time: the clip's sound plays under it.",
rows: [
["`chrome.chapter.list[]`", `1–${CHAPTER_LIMITS.list} \`{at, title ≤${CHAPTER_LIMITS.title}, subtitle? ≤${CHAPTER_LIMITS.subtitle}, date?}\` -- \`at\` the clip it opens, once each`, "`umtool modules apply <p> --config module-config.json` · `umtool look <p> chapter='{…}'`"],
- ["`chrome.chapter.style`", "`card` (the footage box covered) · `lower` (a band at its foot) · default `card`", "`umtool look <p> chapter.style=lower`"],
+ ["`chrome.chapter.style`", `\`card\` (the footage box covered) · \`lower\` (a band at its foot -- except over a POST item, whose card it never covers: it stands in the card's wider free side margin, its words fitted to it; a card with no margin ${CHAPTER_SIDE_MIN} px wide gets no bumper, the rail's section label still marks it) · default \`card\``, "`umtool look <p> chapter.style=lower`"],
["`chrome.chapter.seconds`", `${CHAPTER_LIMITS.seconds[0]}–${CHAPTER_LIMITS.seconds[1]} s, never past the clip · default 3`, "`umtool look <p> chapter.seconds=2.5`"],
],
},
diff --git a/umtool/report-to-video/modules/story.test.mjs b/umtool/report-to-video/modules/story.test.mjs
@@ -4,7 +4,7 @@ import { test } from "node:test";
import assert from "node:assert/strict";
import { frameKeys } from "../frame-keys.mjs";
-import { chapterHtml, chapterWindows, pairHtml, pairSchedule, statusHtml, statusRows, statusStates } from "../chrome-story.mjs";
+import { chapterCover, chapterHtml, chapterPlacement, chapterWindows, CHAPTER_SIDE_MIN, pairHtml, pairSchedule, statusHtml, statusRows, statusStates } from "../chrome-story.mjs";
import { validateChrome } from "../deck.mjs";
import { moduleById, moduleProblems } from "./index.mjs";
import { storyClipErrors, validateChapter, validatePair, validateStatus } from "./story-settings.mjs";
@@ -114,6 +114,43 @@ test("chapter: a window per chapter the cut plays, its page keyed from its offse
assert.equal(mod.regions(schedule, { render: r, outDir: "/tmp/x", clip: { at: 15, dur: 10 }, shift: 15 })[0].offset, 5);
});
+test("chapter: a lower band over a post item never covers its card -- it stands in the card's free side margin", () => {
+ // A section that opens on a post item: its card (schedule.covers, deck.mjs postCovers) in the middle of the footage box.
+ const r = render({ chapter: { style: "lower", list: [{ at: "c", title: "The scale video", subtitle: "23 Oct – 3 Nov 2026", date: "2026-10-23" }, { at: "a", title: "Indy" }] } });
+ const band = chapterCover(r);
+ const card = { x: band.x + 520, y: band.y - 600, width: 767, height: band.height + 560 };
+ const withCard = (c) => ({ ...schedule, covers: [{ segment: "c", from: 20, to: 30, rects: [c] }] });
+ const ws = chapterWindows(withCard(card), r);
+ const wa = ws.find((w) => w.segment === "a"), wc = ws.find((w) => w.segment === "c");
+ assert.equal(wa.place.mode, "band", "a clip's section: the band, as always");
+ assert.equal(wc.place.mode, "side");
+ const touches = (a, b) => a.x < b.x + b.width && b.x < a.x + a.width && a.y < b.y + b.height && b.y < a.y + a.height;
+ assert.ok(!touches(wc.place.rect, card), "the bumper never covers the card");
+ assert.equal(wc.place.side, "left", "the wider margin");
+ assert.equal(wc.place.rect.x + wc.place.rect.width + 16, card.x);
+ // Its page: the band laid in that margin (504 px: its words at full size).
+ const mod = moduleById("chapter");
+ const page = (sch, rr) => chapterHtml(sch, rr, mod.window(sch, { segment: "c", fps: FPS, total: 45, render: rr }), {});
+ const title = (h) => Number(/\.title \{[^}]*font-size: (\d+)px/.exec(h)[1]);
+ const html = page(withCard(card), r);
+ assert.match(html, new RegExp(`\\.chapter \\{[^}]*left: 0px; top: 0px; width: ${wc.place.rect.width}px;`));
+ assert.equal(title(html), 54);
+ // A narrow margin (220 px) and a long word: the words scaled down until it fits, then wrapped.
+ const rl = render({ chapter: { style: "lower", list: [{ at: "c", title: "Unrefundable", date: "2026-10-23" }] } });
+ const narrow = { ...card, x: band.x + 236, width: band.width - 336 };
+ assert.equal(chapterWindows(withCard(narrow), rl)[0].place.rect.width, 220);
+ const t = title(page(withCard(narrow), rl));
+ assert.ok(t < 54 && t >= Math.round(54 * 0.45) && 12 * 0.58 * t <= 220 - 40 + 1, `title ${t}px`);
+ // The measure extras move clear of where it stands, not of the band it left.
+ // A card on the right: the left margin; a card too wide for either margin to hold it: no bumper over it.
+ assert.equal(chapterPlacement(withCard({ ...card, x: band.x + band.width - 900 }), r, wc).side, "left");
+ const wide = { ...card, x: band.x + 100, width: band.width - 200 };
+ assert.ok(100 - 16 < CHAPTER_SIDE_MIN);
+ assert.deepEqual(chapterWindows(withCard(wide), r).map((w) => w.segment), ["a"]);
+ // A card clear of the band's rows (a short card up top): the band, as always.
+ assert.equal(chapterPlacement(withCard({ ...card, height: 200 }), r, wc).mode, "band");
+});
+
test("status: rows come in on their first clip, outcomes fill on theirs", () => {
const r = render({ status: STATUS });
const rows = statusRows(schedule, r);