commit 8adc3bd117680e2a571ceda39e01ef92c8050cd8
parent 709a7f6113f8877cda1af911972444a63fa75312
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Fri, 13 Nov 2026 22:53:28 -0500
clip editor: Zoom here fits the zoom inside the cut (moved back from its end, held as long as fits)
A zoom added at a playhead near the cut's end ran past the clip's window and the writer
refused it. The control now moves it back and shortens its hold (at least 0.3 s), and is
off when even that does not fit. Found by clip-kit.spec.
Co-Authored-By: Claude <noreply@anthropic.com>
Diffstat:
2 files changed, 18 insertions(+), 5 deletions(-)
diff --git a/umtool/components/projects/review/ClipEditor.tsx b/umtool/components/projects/review/ClipEditor.tsx
@@ -1740,7 +1740,7 @@ function ShortMaker({ project, clipId, short, framed, framing, onFraming, onCent
{onKit && onRecordingCensor && (
<HideRegions clipId={clipId} own={kit.censor ?? null} recording={recordingCensor[0] ?? null} playhead={playhead} busy={busy} onKit={onKit} onRecording={onRecordingCensor} />
)}
- {onKit && <ZoomList clipId={clipId} zooms={Array.isArray(kit.zooms) ? (kit.zooms as Zoom[]) : []} playhead={playhead} busy={busy} onKit={onKit} />}
+ {onKit && <ZoomList clipId={clipId} zooms={Array.isArray(kit.zooms) ? (kit.zooms as Zoom[]) : []} playhead={playhead} cut={cut} busy={busy} onKit={onKit} />}
{job && (
<p data-short-job={job.state} className="m-0 text-[12px] text-text-2">
{running ? "Rendering 1080×1920 in the heavy slot" : job.state === "done" ? "Made — on the Deliver tab's Shorts list" : `Failed${job.error ? `: ${job.error}` : ""}`}
@@ -1888,8 +1888,17 @@ function HideRegions({ clipId, own, recording, playhead, busy, onKit, onRecordin
type Zoom = { at: number; scale?: number; hold?: number; focus?: [number, number]; box?: number[]; ramp?: number };
-function ZoomList({ clipId, zooms, playhead, busy, onKit }: { clipId: string; zooms: Zoom[]; playhead: number | null; busy: boolean; onKit: (patch: Record<string, unknown>, done: string) => void }) {
+function ZoomList({ clipId, zooms, playhead, cut, busy, onKit }: { clipId: string; zooms: Zoom[]; playhead: number | null; cut: { cutStart: number; cutEnd: number } | null; busy: boolean; onKit: (patch: Record<string, unknown>, done: string) => void }) {
const write = (next: Zoom[], done: string) => onKit({ zooms: next.length ? [...next].sort((a, b) => a.at - b.at) : null }, done);
+ // A zoom at the playhead that fits the cut: in and out (0.4 s each way) and held up to 1.5 s, moved back when the
+ // playhead is too near the end (the build refuses one past the clip).
+ const fitted = (): Zoom | null => {
+ if (playhead === null) return null;
+ const end = cut?.cutEnd ?? Infinity;
+ const at = Math.max(cut?.cutStart ?? 0, Math.min(playhead, end - 1.1));
+ const hold = Math.min(1.5, Math.floor((end - at - 0.8) * 10) / 10);
+ return hold >= 0.3 ? { at: Math.round(at * 100) / 100, scale: 1.3, hold } : null;
+ };
const change = (i: number, z: Zoom) => write(zooms.map((x, j) => (j === i ? z : x)), "Saved the zoom");
return (
<div className="space-y-1" data-kit-zooms={clipId}>
@@ -1898,8 +1907,11 @@ function ZoomList({ clipId, zooms, playhead, busy, onKit }: { clipId: string; zo
<button
type="button"
data-zoom-add={clipId}
- disabled={busy || playhead === null}
- onClick={() => write([...zooms, { at: Math.round((playhead ?? 0) * 100) / 100, scale: 1.3, hold: 1.5 }], "A zoom at the playhead")}
+ disabled={busy || !fitted()}
+ onClick={() => {
+ const z = fitted();
+ if (z) write([...zooms, z], "A zoom at the playhead");
+ }}
className={buttonVariants({ variant: "quiet", size: "sm" })}
title="push the picture in at the playhead (×1.3, held 1.5 s, about the picture's centre)"
>
diff --git a/umtool/e2e/clip-kit.spec.ts b/umtool/e2e/clip-kit.spec.ts
@@ -92,7 +92,8 @@ test("the clip editor: a clip's own QR corner, its end card off and back, the pr
await expect(page.locator("[data-zoom-add='r001']")).toBeEnabled();
await page.locator("[data-zoom-add='r001']").click();
await expect.poll(() => clip("r001")?.zooms?.length ?? 0).toBe(1);
- expect(clip("r001").zooms[0]).toMatchObject({ scale: 1.3, hold: 1.5 });
+ // The playhead is near the cut's end (1-3 s): the zoom is moved back and held as long as fits.
+ expect(clip("r001").zooms[0]).toMatchObject({ at: 1.9, scale: 1.3, hold: 0.3 });
await page.locator("[data-zoom-scale='0']").selectOption("1.5");
await expect.poll(() => clip("r001")?.zooms?.[0]?.scale).toBe(1.5);
await page.locator("[data-zoom-remove='0']").click();