fix(story-mode): the final panel grows to its words, never clipping a chip or a long ending

From review round 10: the chip "1 commit, copied to remote.git" was cut
off at the final panel's edge (on four of the eleven sessions), and so
would any ending longer than the panel's fixed 270 px. The final panel's
words now sit in flow, so its row grows (and a phone's 430 px is a
minimum). Its scene keeps the usual size, the panel's minimum height as
its stage, standing at the bottom with the background filling the rest;
otherwise a taller panel scaled Claude up with it. On a phone the words
end above Claude.

The browser test fills the final balloon with a long ending and checks
every chip, the balloon and the title lie inside the panel, at desktop
and phone width; it fails on the old layout.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Codeman maintainer committed 2026-10-18 17:10:35 +02:00
1 parent f46369a5af
commit 05dc6fbd95
4 files changed
+61 -18

No files matched your search

+21 -10
View File
@@ -308,7 +308,8 @@ body.story-open {
.story-page {
display: grid;
grid-template-columns: repeat(6, minmax(0, 1fr));
grid-auto-rows: 270px;
/* A row grows only for the final panel, whose words and chips are in flow (never clipped). */
grid-auto-rows: minmax(270px, auto);
gap: 14px;
padding: 14px;
}
@@ -542,13 +543,20 @@ body.story-open .toast-container {
background: var(--story-live-bg);
}
/* The final panel's words sit in flow, so a long ending or a second row of chips makes the panel
taller instead of being cut off at its edge. */
.story-panel[data-kind='complete'] {
display: flex;
/* The row's own height, read back as the scene's stage when the words make the panel taller. */
min-height: 270px;
}
.story-splash {
position: absolute;
position: relative;
z-index: 2;
left: 12px;
top: 12px;
bottom: 12px;
width: 46%;
box-sizing: border-box;
flex: 0 0 46%;
max-width: 46%;
margin: 12px;
display: flex;
flex-direction: column;
justify-content: space-between;
@@ -658,12 +666,15 @@ body.story-open .toast-container {
height: 300px;
}
.story-panel[data-kind='complete'] {
height: 430px;
height: auto;
min-height: 430px;
}
.story-splash {
right: 12px;
bottom: auto;
width: auto;
flex: 1 1 auto;
max-width: none;
justify-content: flex-start;
/* Claude stands centred at the bottom on a phone: the words end above it. */
margin-bottom: 170px;
}
.story-splash-title {
font-size: 36px;
+17 -7
View File
@@ -1423,7 +1423,8 @@ const StoryArt = (() => {
fullWidth: true,
bg(ctx, W, H) {
base(ctx, W, H);
rays(ctx, W, H, W > 420 ? W * 0.72 : W / 2, 200, 30, C.cyan, 0.32);
// Centred on Claude, who stands at the bottom of the stage (H - 60 is 200 on a normal panel).
rays(ctx, W, H, W > 420 ? W * 0.72 : W / 2, H - 60, 30, C.cyan, 0.32);
halftone(ctx, W, H, C.magenta, W, 0, { rmax: 3.4, reach: 0.85, alpha: 0.75 });
},
draw(ctx, W, H, f, p) {
@@ -2612,6 +2613,11 @@ Object.assign(CodemanApp.prototype, {
if (w === rt.w && h === rt.h && dpr === rt.dpr) return;
rt.w = w;
rt.h = h;
// A final panel its words made taller keeps its scene at the usual size, standing at the bottom:
// the stage is the panel's minimum height (inside its border), the rest is background.
const minH = rt.splash ? parseFloat(getComputedStyle(rt.el).minHeight) || 0 : 0;
const border = rt.el.offsetHeight - rt.el.clientHeight;
rt.stageH = minH > border ? Math.min(h, minH - border) : h;
rt.dpr = dpr;
rt.canvas.width = Math.max(1, Math.round(w * dpr));
rt.canvas.height = Math.max(1, Math.round(h * dpr));
@@ -2630,8 +2636,12 @@ Object.assign(CodemanApp.prototype, {
if (!rt.panel || !rt.w || !rt.h) return;
const scene = StoryArt.SCENES[rt.kind];
if (!scene) return;
const s = rt.h / StoryArt.VH;
const s = (rt.stageH || rt.h) / StoryArt.VH;
const W = rt.w / s;
// Scene units down the whole panel: VH, or more on a final panel its words made taller, whose
// stage then stands at the bottom (oy) with background above it.
const H = rt.h / s;
const oy = H - StoryArt.VH;
const k = rt.dpr * s;
const key = `${rt.kind}|${rt.canvas.width}x${rt.canvas.height}|${StoryArt.C.key}`;
if (rt.bgKey !== key) {
@@ -2657,14 +2667,14 @@ Object.assign(CodemanApp.prototype, {
// Without a frame loop (tests, a browser that never paints) the whole background at once.
const steps = st?.raf && !full ? 1 : job.total - job.next;
for (let i = 0; i < steps && b; i++, job.next++) {
const top = (StoryArt.VH / job.total) * job.next;
const bottom = top + StoryArt.VH / job.total;
const top = (H / job.total) * job.next;
const bottom = top + H / job.total;
b.save();
b.setTransform(k, 0, 0, k, 0, 0);
b.beginPath();
b.rect(0, top, W, bottom - top);
b.clip();
StoryArt.inBand(top, bottom, () => scene.bg(b, W, StoryArt.VH));
StoryArt.inBand(top, bottom, () => scene.bg(b, W, H));
b.restore();
}
if (!b) job.next = job.total;
@@ -2677,9 +2687,9 @@ Object.assign(CodemanApp.prototype, {
ctx.drawImage(job.canvas, 0, 0);
const stageW = scene.fullWidth ? W : Math.min(W, STORY_STAGE_MAX);
const ox = (W - stageW) / 2;
ctx.setTransform(k, 0, 0, k, ox * k, 0);
ctx.setTransform(k, 0, 0, k, ox * k, oy * k);
const hits = [];
const hit = (id, x, y, w, h, label) => hits.push({ id, x: x + ox, y, w, h, label });
const hit = (id, x, y, w, h, label) => hits.push({ id, x: x + ox, y: y + oy, w, h, label });
StoryArt.takeSpeaker();
scene.draw(
ctx,