Skip to content

Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.

feat(timeline): flag zoom moves a clip junction cuts (#1028)

EtienneLescotb96b666fc2ef
diff --git a/electron/ai-edition/agent-tools.test.ts b/electron/ai-edition/agent-tools.test.ts
index 5b7c37174..96bdc852c 100644
--- a/electron/ai-edition/agent-tools.test.ts
+++ b/electron/ai-edition/agent-tools.test.ts
@@ -2537,7 +2537,9 @@ describe("zoom transitions are reported, not hidden (#1028)", () => {
it("warns when a trim at the zoom's end cuts its whole zoom-out (the issue's repro)", () => {
const trimmed = run(zoomedAt10to12().document, "addTrim", { startSec: 12, endSec: 14 });
const zoomId = snapshotZoom(trimmed.document).id;
- expect(trimmed.payload.cutTransitions).toEqual([{ zoomId, side: "out", cutSec: MOVE_SEC }]);
+ expect(trimmed.payload.cutTransitions).toEqual([
+ { zoomId, side: "out", cutSec: MOVE_SEC, by: "trim" },
+ ]);
expect(snapshotZoom(trimmed.document).cutByTrim).toBe("out");
});
@@ -2578,7 +2580,7 @@ describe("zoom transitions are reported, not hidden (#1028)", () => {
depth: 3,
});
expect(added.payload.cutTransitions).toEqual([
- { zoomId: added.payload.zoomId, side: "out", cutSec: MOVE_SEC },
+ { zoomId: added.payload.zoomId, side: "out", cutSec: MOVE_SEC, by: "trim" },
]);
});
@@ -2591,7 +2593,7 @@ describe("zoom transitions are reported, not hidden (#1028)", () => {
const trimmed = run(shortSingleClip(), "addTrim", { startSec: 8, endSec: 9.5 });
const added = run(trimmed.document, "addZoom", { startSec: 10, endSec: 12, depth: 3 });
expect(added.payload.cutTransitions).toEqual([
- { zoomId: added.payload.zoomId, side: "in", cutSec: 0.423 },
+ { zoomId: added.payload.zoomId, side: "in", cutSec: 0.423, by: "trim" },
]);
expect(snapshotZoom(added.document).cutByTrim).toBe("in");
});
@@ -2601,7 +2603,7 @@ describe("zoom transitions are reported, not hidden (#1028)", () => {
const zoomId = snapshotZoom(trimmed.document).id;
const moved = run(trimmed.document, "setZoom", { zoomId, startSec: 9 });
expect(moved.payload.cutTransitions).toEqual([
- { zoomId: moved.payload.zoomId, side: "out", cutSec: MOVE_SEC },
+ { zoomId: moved.payload.zoomId, side: "out", cutSec: MOVE_SEC, by: "trim" },
]);
});
@@ -2630,8 +2632,8 @@ describe("zoom transitions are reported, not hidden (#1028)", () => {
const [first, second] = run(trimmed.document, "getCurrentDocument", {}).payload.zoomRanges;
expect(first.panToZoomId).toBeUndefined();
expect(trimmed.payload.cutTransitions).toEqual([
- { zoomId: first.id, side: "out", cutSec: MOVE_SEC },
- { zoomId: second.id, side: "in", cutSec: MOVE_SEC },
+ { zoomId: first.id, side: "out", cutSec: MOVE_SEC, by: "trim" },
+ { zoomId: second.id, side: "in", cutSec: MOVE_SEC, by: "trim" },
]);
});
@@ -2653,6 +2655,45 @@ describe("zoom transitions are reported, not hidden (#1028)", () => {
const zooms = run(both.document, "getCurrentDocument", {}).payload.zoomRanges;
expect(zooms[0].panToZoomId).toBeUndefined();
expect(zooms[0].zoomOutUntilSec).toBe(12 + MOVE_SEC);
+
+ // Each clip renders on its own: the junction cuts the first zoom's whole zoom-out and
+ // the start of the second one's zoom-in, and says it is a junction, not a trim.
+ expect(first.payload.cutTransitions).toEqual([
+ { zoomId: first.payload.zoomId, side: "out", cutSec: MOVE_SEC, by: "junction" },
+ ]);
+ expect(both.payload.cutTransitions).toEqual([
+ { zoomId: both.payload.zoomId, side: "in", cutSec: 0.423, by: "junction" },
+ ]);
+ expect(zooms[0]).toMatchObject({ cutByJunction: "out" });
+ expect(zooms[1]).toMatchObject({ cutByJunction: "in" });
+ expect(zooms[0].cutByTrim).toBeUndefined();
+ expect(zooms[1].cutByTrim).toBeUndefined();
+ });
+
+ it("names a trim and a junction apart on the same zoom", () => {
+ const base = shortSingleClip();
+ const clip = base.timeline.clips[0];
+ const twoClips: AxcutDocument = {
+ ...base,
+ timeline: {
+ ...base.timeline,
+ clips: [
+ { ...clip, sourceEndSec: 12.5, timelineEndSec: 12.5 },
+ { ...clip, id: "clip_2", sourceStartSec: 12.5, timelineStartSec: 12.5 },
+ ],
+ },
+ };
+ const zoomed = run(twoClips, "addZoom", { startSec: 10, endSec: 12, depth: 3 });
+ const trimmed = run(zoomed.document, "addTrim", { startSec: 9, endSec: 9.5 });
+ expect(snapshotZoom(trimmed.document)).toMatchObject({ cutByTrim: "in", cutByJunction: "out" });
+ });
+
+ it("does not call the end of the timeline a junction", () => {
+ const base = shortSingleClip();
+ const end = base.timeline.clips[0].timelineEndSec;
+ const added = run(base, "addZoom", { startSec: end - 2, endSec: end - 0.5, depth: 3 });
+ expect(added.payload.cutTransitions).toBeUndefined();
+ expect(snapshotZoom(added.document).cutByJunction).toBeUndefined();
});
it("stretches the zoom-out across a speed region, and catches a trim placed there", () => {
@@ -2660,7 +2701,7 @@ describe("zoom transitions are reported, not hidden (#1028)", () => {
expect(snapshotZoom(sped.document).zoomOutUntilSec).toBe(14.77);
const trimmed = run(sped.document, "addTrims", { ranges: [{ startSec: 14, endSec: 15 }] });
expect(trimmed.payload.applied[0].cutTransitions).toEqual([
- { zoomId: snapshotZoom(trimmed.document).id, side: "out", cutSec: 0.77 },
+ { zoomId: snapshotZoom(trimmed.document).id, side: "out", cutSec: 0.77, by: "trim" },
]);
});
});
diff --git a/electron/ai-edition/agent-tools.ts b/electron/ai-edition/agent-tools.ts
index 3a94ccdab..be872bb7d 100644
--- a/electron/ai-edition/agent-tools.ts
+++ b/electron/ai-edition/agent-tools.ts
@@ -721,9 +721,9 @@ function roundSec(ms: number): number {
return Math.round(ms) / 1000;
}
-// Each zoom pill's camera moves in virtual ms, and how much of each a trim cuts off (#1028).
+// Each zoom pill's camera moves in virtual ms, and how much of each a cut takes off (#1028).
// The pill shows the hold only: the move in runs before it, the move out after it, and a
-// trim over either makes the export jump at the cut.
+// trim or a clip junction over either makes the export jump at the cut.
function zoomTransitionsForAgent(document: AxcutDocument) {
const legacy = document.legacyEditor as Record<string, unknown> | null;
const speedRegions =
@@ -745,22 +745,25 @@ function zoomTransitionsForAgent(document: AxcutDocument) {
});
});
// Chained zooms pan from one to the next instead: no zoom-out, no zoom-in, nothing to cut
- // (a trim between them would have broken the chain).
+ // (a trim or a junction between them would have broken the chain). A junction is where a
+ // clip starts after another: the timeline's own end has nothing after it to jump to.
const zooms = coalesceForAgent(document.zoomRanges);
- const junctions = document.timeline.clips.map((clip) => ({
- startMs: clip.timelineEndSec * 1000,
- endMs: clip.timelineEndSec * 1000,
- }));
+ const junctions = document.timeline.clips
+ .filter((clip) => clip.timelineStartSec > 0)
+ .map((clip) => ({
+ startMs: clip.timelineStartSec * 1000,
+ endMs: clip.timelineStartSec * 1000,
+ }));
const pans = chainedPans(zooms, speedRegions, [...trims, ...junctions]);
return zooms.map((zoom, i) => {
const transitions = zoomTransitions({ ...zoom, scale: effectiveZoomScale(zoom) }, speedRegions);
const panOut = pans.find((p) => p.from === i);
const panIn = pans.find((p) => p.to === i);
- const cut = transitionCutsMs(zoom, transitions, trims);
+ const cut = transitionCutsMs(zoom, transitions, trims, junctions);
return {
zoom,
transitions,
- cut: { inMs: panIn ? 0 : cut.inMs, outMs: panOut ? 0 : cut.outMs },
+ cut: { ...cut, inMs: panIn ? 0 : cut.inMs, outMs: panOut ? 0 : cut.outMs },
panTo: panOut && { zoomId: zooms[panOut.to].id, untilMs: panOut.untilMs },
panFromZoomId: panIn && zooms[panIn.from].id,
};
@@ -777,6 +780,7 @@ function cutTransitionsReport(before: AxcutDocument, after: AxcutDocument) {
zoomId: zoom.id,
side,
cutSec: roundSec(side === "in" ? cut.inMs : cut.outMs),
+ by: (side === "in" ? cut.inByJunction : cut.outByJunction) ? "junction" : "trim",
key: `${zoom.id}:${side}:${zoom.startMs}:${zoom.endMs}`,
}))
.filter((c) => c.cutSec > 0),
@@ -788,6 +792,13 @@ function cutTransitionsReport(before: AxcutDocument, after: AxcutDocument) {
return cuts.length ? { cutTransitions: cuts } : {};
}
+/** The moves a trim (or, with `byJunction`, a clip junction) cuts: in, out, both or none. */
+function cutSides(cut: ReturnType<typeof transitionCutsMs>, byJunction: boolean) {
+ const cutIn = cut.inMs > 0 && cut.inByJunction === byJunction;
+ const cutOut = cut.outMs > 0 && cut.outByJunction === byJunction;
+ return cutIn ? (cutOut ? "both" : "in") : cutOut ? "out" : undefined;
+}
+
// Compact projection of the document for the model: everything it needs to
// reference ids and times, nothing it doesn't (no waveform paths, no history).
//
@@ -842,7 +853,7 @@ export function documentSnapshotForModel(
"a setZoom that only changes depth on such a zoom clears customScale so the depth takes effect. " +
"startSec–endSec is where the zoom HOLDS: it animates in over zoomInFromSec–startSec and out over " +
"endSec–zoomOutUntilSec (transitionSec of screen time each; a speed region scales that on the " +
- "timeline, longer above 1x and shorter below, so read the bounds rather than adding transitionSec). cutByTrim names the move a trim cuts into (in, out or both): the export jumps at that cut. " +
+ "timeline, longer above 1x and shorter below, so read the bounds rather than adding transitionSec). cutByTrim names the move a trim cuts into (in, out or both), cutByJunction the move a clip junction cuts (the clip ends before the move does): the export jumps at that cut. " +
"Two zooms at most 1.5 s apart on screen, with no trim or clip junction between them, are CHAINED: " +
"no zoom-out and back in, the camera pans from the first (panToZoomId, panUntilSec: 1 s of screen " +
"time from its endSec, which can run into the next span) to the second (panFromZoomId).",
@@ -912,9 +923,8 @@ export function documentSnapshotForModel(
? { panToZoomId: panTo.zoomId, panUntilSec: roundSec(panTo.untilMs) }
: { zoomOutUntilSec: roundSec(transitions.outUntilMs) }),
transitionSec: roundSec(transitions.durationMs),
- ...(cut.inMs > 0 || cut.outMs > 0
- ? { cutByTrim: cut.inMs > 0 ? (cut.outMs > 0 ? "both" : "in") : "out" }
- : {}),
+ ...(cutSides(cut, false) ? { cutByTrim: cutSides(cut, false) } : {}),
+ ...(cutSides(cut, true) ? { cutByJunction: cutSides(cut, true) } : {}),
depth: z.depth,
renderedScale: effectiveZoomScale(z),
// Emitted only when set: an unconditional `customScale: null` on every
diff --git a/electron/ai-edition/deep-agent/service.ts b/electron/ai-edition/deep-agent/service.ts
index 8281d52df..81b084824 100644
--- a/electron/ai-edition/deep-agent/service.ts
+++ b/electron/ai-edition/deep-agent/service.ts
@@ -146,7 +146,7 @@ export const SYSTEM_PROMPT = buildSystemPrompt({ editsAllowed: true });
// #1028: a zoom's camera moves sit OUTSIDE its span, where nothing on the ruler shows them.
const ZOOM_TRANSITIONS_NOTE = `A zoom HOLDS over its span: it animates in during the window just before startSec and out during the window just after endSec. Each move lasts 0.6 s + 0.55 s × ln(renderedScale) of SCREEN time (${ZOOM_TRANSITION_LEGEND}), so a speed region scales the timeline it covers by its speed: longer above 1×, shorter below. getCurrentDocument gives each zoom's zoomInFromSec and zoomOutUntilSec, in virtual seconds like the zoom. A trim inside either window cuts that move and the export jumps at the cut: leave the windows untrimmed. Two zooms at most 1.5 s apart on screen, on the same clip with no trim between them, are chained: the camera pans from one to the next over 1 s of screen time from the first one's end (panUntilSec), with no zoom-out or zoom-in between them.`;
-const CUT_TRANSITIONS_RESULT = `When the result cuts a zoom's move in or out, it carries \`cutTransitions\`: which zoom, which side, and cutSec, the timeline seconds of the move lost. It is a warning, nothing is refused: move the cut or the zoom unless a hard cut is what you want.`;
+const CUT_TRANSITIONS_RESULT = `When the result cuts a zoom's move in or out, it carries \`cutTransitions\`: which zoom, which side, cutSec, the timeline seconds of the move lost, and by: trim, or junction when the move runs past its clip's edge into the next clip. It is a warning, nothing is refused: move the cut or the zoom unless a hard cut is what you want.`;
export const TOOL_DESCRIPTIONS: Record<string, string> = {
getCurrentDocument:
diff --git a/src/components/ai-edition/v4/V4Timeline.geometry.test.tsx b/src/components/ai-edition/v4/V4Timeline.geometry.test.tsx
index e5e717e52..3eba71197 100644
--- a/src/components/ai-edition/v4/V4Timeline.geometry.test.tsx
+++ b/src/components/ai-edition/v4/V4Timeline.geometry.test.tsx
@@ -1097,10 +1097,10 @@ describe("V4Timeline zoom trails", () => {
const trail = (side: "in" | "out" | "pan") =>
document.querySelector<HTMLElement>(`[data-zoom-trail="${side}"]`) as HTMLElement;
- function renderZoom(overrides: Record<string, unknown>) {
+ function renderZoom(overrides: Record<string, unknown>, clips?: ReturnType<typeof clip>[]) {
i18n.translate = (namespace, key, vars) =>
translate("en", namespace as I18nNamespace, key, vars);
- renderTimeline(undefined, undefined, [NO_CAMERA_ASSET], undefined, {
+ renderTimeline(clips, undefined, [NO_CAMERA_ASSET], undefined, {
zoomRegions: [ZOOM],
...overrides,
});
@@ -1125,6 +1125,26 @@ describe("V4Timeline zoom trails", () => {
expect(Number.parseFloat(cut?.style.width ?? "")).toBeCloseTo(100, 6);
});
+ it("hatches the part of a zoom-out past a clip junction, naming the junction", () => {
+ renderZoom({}, [clip(0, 12.5), clip(12.5, TOTAL_SEC)]);
+ const lost = 12 + W_SEC - 12.5;
+ expect(trail("out")).toHaveAccessibleName(
+ `A clip junction removes ${lost.toFixed(2)} s of the zoom-out. The export jumps at the junction.`,
+ );
+ const cut = trail("out").querySelector<HTMLElement>("[data-zoom-trail-cut]");
+ expect(Number.parseFloat(cut?.style.left ?? "")).toBeCloseTo((0.5 / W_SEC) * 100, 6);
+ expect(Number.parseFloat(cut?.style.width ?? "")).toBeCloseTo((lost / W_SEC) * 100, 6);
+ expect(trail("in").querySelector("[data-zoom-trail-cut]")).toBeNull();
+ });
+
+ it("does not call the end of the timeline a junction", () => {
+ const end = TOTAL_SEC * 1000;
+ renderZoom({ zoomRegions: [{ ...ZOOM, startMs: end - 2000, endMs: end - 500 }] });
+ expect(trail("out")).toHaveAccessibleName(
+ "Zoom-out: the view moves back out after the zoom ends",
+ );
+ });
+
it("draws one pan between chained zooms instead of a zoom-out and a zoom-in", () => {
renderZoom({ zoomRegions: [ZOOM, { id: "z2", startMs: 12_500, endMs: 14_000, depth: 3 }] });
const trails = [...document.querySelectorAll<HTMLElement>("[data-zoom-trail]")];
diff --git a/src/components/ai-edition/v4/V4Timeline.tsx b/src/components/ai-edition/v4/V4Timeline.tsx
index 8f8bce9b4..8ca815883 100644
--- a/src/components/ai-edition/v4/V4Timeline.tsx
+++ b/src/components/ai-edition/v4/V4Timeline.tsx
@@ -1842,7 +1842,8 @@ export function V4Timeline({
// Each zoom's camera moves (#1028): the pill shows the hold, the zoom-in runs in the trail
// before it and the zoom-out in the trail after it, on the speed-aware clock the compositor
- // uses. The part a trim cuts is hatched: the export jumps there instead of easing. Chained
+ // uses. The part a trim or a clip junction cuts is hatched: the export jumps there instead of
+ // easing. The timeline's own end is no junction: nothing plays after it to jump to. Chained
// zooms get one pan trail between them instead of a zoom-out and a zoom-in. Display only,
// not a control. Hidden while a clip is dragged, when the pills split and slide.
const renderZoomTrails = () => {
@@ -1860,14 +1861,16 @@ export function V4Timeline({
const totalMs = total * 1000;
const sec = (cutMs: number) => (cutMs / 1000).toFixed(2);
const zooms = zoomRuns.map((r) => ms(liveSpan(r.ids[0], r)));
- const junctions = clips.map((c) => ms({ start: c.timelineEndSec, end: c.timelineEndSec }));
+ const junctions = clips
+ .filter((c) => c.timelineStartSec > 0)
+ .map((c) => ms({ start: c.timelineStartSec, end: c.timelineStartSec }));
const pans = chainedPans(zooms, speeds, [...trims, ...junctions]);
return zoomRuns.flatMap((r, i) => {
const zoom = zooms[i];
const pan = pans.find((p) => p.from === i);
const panned = pans.some((p) => p.to === i);
const moves = zoomTransitions({ ...zoom, scale: effectiveZoomScale(r.member) }, speeds);
- const cut = transitionCutsMs(zoom, moves, trims);
+ const cut = transitionCutsMs(zoom, moves, trims, junctions);
const outUntilMs = Math.min(moves.outUntilMs, totalMs);
const zoomIn = {
side: "in",
@@ -1875,7 +1878,12 @@ export function V4Timeline({
toMs: zoom.startMs,
cutFromMs: moves.inFromMs,
cutToMs: moves.inFromMs + cut.inMs,
- text: cut.inMs > 0 ? t("trails.zoomInCut", { seconds: sec(cut.inMs) }) : t("trails.zoomIn"),
+ text:
+ cut.inMs > 0
+ ? t(cut.inByJunction ? "trails.zoomInJunction" : "trails.zoomInCut", {
+ seconds: sec(cut.inMs),
+ })
+ : t("trails.zoomIn"),
};
const trails = [
...(panned ? [] : [zoomIn]),
@@ -1896,7 +1904,9 @@ export function V4Timeline({
cutToMs: outUntilMs,
text:
cut.outMs > 0
- ? t("trails.zoomOutCut", { seconds: sec(cut.outMs) })
+ ? t(cut.outByJunction ? "trails.zoomOutJunction" : "trails.zoomOutCut", {
+ seconds: sec(cut.outMs),
+ })
: t("trails.zoomOut"),
},
];
diff --git a/src/i18n/locales/ar/timeline.json b/src/i18n/locales/ar/timeline.json
index 16ebbd06e..21e5d5fae 100644
--- a/src/i18n/locales/ar/timeline.json
+++ b/src/i18n/locales/ar/timeline.json
@@ -38,6 +38,8 @@
"zoomOut": "التصغير التدريجي: تبتعد الصورة مجددًا بعد نهاية التكبير",
"zoomInCut": "يزيل قص {{seconds}} ث من التكبير التدريجي. يقفز التصدير عند القص.",
"zoomOutCut": "يزيل قص {{seconds}} ث من التصغير التدريجي. يقفز التصدير عند القص.",
+ "zoomInJunction": "يزيل الانتقال بين المقاطع {{seconds}} ث من التكبير التدريجي. يقفز التصدير عند نقطة الانتقال.",
+ "zoomOutJunction": "يزيل الانتقال بين المقاطع {{seconds}} ث من التصغير التدريجي. يقفز التصدير عند نقطة الانتقال.",
"pan": "تحريك: تنتقل الصورة مباشرة إلى التكبير التالي"
},
"emptyState": {
diff --git a/src/i18n/locales/cs/timeline.json b/src/i18n/locales/cs/timeline.json
index 157183fb8..9e93b4eb7 100644
--- a/src/i18n/locales/cs/timeline.json
+++ b/src/i18n/locales/cs/timeline.json
@@ -38,6 +38,8 @@
"zoomOut": "Oddálení: pohled se po konci přiblížení znovu oddaluje",
"zoomInCut": "Oříznutí odstraní {{seconds}} s najetí. Export v místě střihu skočí.",
"zoomOutCut": "Oříznutí odstraní {{seconds}} s oddálení. Export v místě střihu skočí.",
+ "zoomInJunction": "Spoj klipů odstraní {{seconds}} s najetí. Export v místě spoje skočí.",
+ "zoomOutJunction": "Spoj klipů odstraní {{seconds}} s oddálení. Export v místě spoje skočí.",
"pan": "Posun: pohled přejede rovnou na další přiblížení"
},
"emptyState": {
diff --git a/src/i18n/locales/de/timeline.json b/src/i18n/locales/de/timeline.json
index 5ed9cea9c..fa18db607 100644
--- a/src/i18n/locales/de/timeline.json
+++ b/src/i18n/locales/de/timeline.json
@@ -38,6 +38,8 @@
"zoomOut": "Herauszoomen: Die Ansicht zoomt nach dem Ende des Zooms wieder heraus",
"zoomInCut": "Ein Trim entfernt {{seconds}} s des Hineinzoomens. Der Export springt am Schnitt.",
"zoomOutCut": "Ein Trim entfernt {{seconds}} s des Herauszoomens. Der Export springt am Schnitt.",
+ "zoomInJunction": "Ein Clip-Übergang entfernt {{seconds}} s des Hineinzoomens. Der Export springt am Übergang.",
+ "zoomOutJunction": "Ein Clip-Übergang entfernt {{seconds}} s des Herauszoomens. Der Export springt am Übergang.",
"pan": "Schwenk: Die Ansicht fährt direkt zum nächsten Zoom"
},
"emptyState": {
diff --git a/src/i18n/locales/en/timeline.json b/src/i18n/locales/en/timeline.json
index 955a0e515..ec4b8d28f 100644
--- a/src/i18n/locales/en/timeline.json
+++ b/src/i18n/locales/en/timeline.json
@@ -38,6 +38,8 @@
"zoomOut": "Zoom-out: the view moves back out after the zoom ends",
"zoomInCut": "A trim removes {{seconds}} s of the zoom-in. The export jumps at the cut.",
"zoomOutCut": "A trim removes {{seconds}} s of the zoom-out. The export jumps at the cut.",
+ "zoomInJunction": "A clip junction removes {{seconds}} s of the zoom-in. The export jumps at the junction.",
+ "zoomOutJunction": "A clip junction removes {{seconds}} s of the zoom-out. The export jumps at the junction.",
"pan": "Pan: the view moves straight to the next zoom"
},
"emptyState": {
diff --git a/src/i18n/locales/es/timeline.json b/src/i18n/locales/es/timeline.json
index a626aeada..f4fcd4374 100644
--- a/src/i18n/locales/es/timeline.json
+++ b/src/i18n/locales/es/timeline.json
@@ -38,6 +38,8 @@
"zoomOut": "Alejamiento: la vista se aleja de nuevo cuando termina el zoom",
"zoomInCut": "Un recorte quita {{seconds}} s del acercamiento. La exportación salta en el corte.",
"zoomOutCut": "Un recorte quita {{seconds}} s del alejamiento. La exportación salta en el corte.",
+ "zoomInJunction": "Una unión entre clips quita {{seconds}} s del acercamiento. La exportación salta en la unión.",
+ "zoomOutJunction": "Una unión entre clips quita {{seconds}} s del alejamiento. La exportación salta en la unión.",
"pan": "Paneo: la vista pasa directamente al siguiente zoom"
},
"emptyState": {
diff --git a/src/i18n/locales/fr/timeline.json b/src/i18n/locales/fr/timeline.json
index 303543735..4fd7b3123 100644
--- a/src/i18n/locales/fr/timeline.json
+++ b/src/i18n/locales/fr/timeline.json
@@ -38,6 +38,8 @@
"zoomOut": "Zoom arrière : l'image s'élargit à nouveau après la fin du zoom",
"zoomInCut": "Une coupe retire {{seconds}} s du zoom avant. L'export saute à la coupe.",
"zoomOutCut": "Une coupe retire {{seconds}} s du zoom arrière. L'export saute à la coupe.",
+ "zoomInJunction": "Une jonction entre clips retire {{seconds}} s du zoom avant. L'export saute à la jonction.",
+ "zoomOutJunction": "Une jonction entre clips retire {{seconds}} s du zoom arrière. L'export saute à la jonction.",
"pan": "Panoramique : l'image glisse directement vers le zoom suivant"
},
"emptyState": {
diff --git a/src/i18n/locales/it/timeline.json b/src/i18n/locales/it/timeline.json
index 06713fa1b..e73a04db9 100644
--- a/src/i18n/locales/it/timeline.json
+++ b/src/i18n/locales/it/timeline.json
@@ -38,6 +38,8 @@
"zoomOut": "Zoom out: la vista si allontana di nuovo dopo la fine dello zoom",
"zoomInCut": "Un taglio rimuove {{seconds}} s dello zoom in. L'esportazione salta al taglio.",
"zoomOutCut": "Un taglio rimuove {{seconds}} s dello zoom out. L'esportazione salta al taglio.",
+ "zoomInJunction": "Una giunzione tra clip rimuove {{seconds}} s dello zoom in. L'esportazione salta alla giunzione.",
+ "zoomOutJunction": "Una giunzione tra clip rimuove {{seconds}} s dello zoom out. L'esportazione salta alla giunzione.",
"pan": "Panoramica: la vista si sposta direttamente allo zoom successivo"
},
"emptyState": {
diff --git a/src/i18n/locales/ja-JP/timeline.json b/src/i18n/locales/ja-JP/timeline.json
index adebdc04b..0f41b8fc9 100644
--- a/src/i18n/locales/ja-JP/timeline.json
+++ b/src/i18n/locales/ja-JP/timeline.json
@@ -38,6 +38,8 @@
"zoomOut": "ズームアウト:ズームの終了後に画面が元に戻ります",
"zoomInCut": "トリムでズームインの {{seconds}} 秒が削除されます。書き出しはカット位置で飛びます。",
"zoomOutCut": "トリムでズームアウトの {{seconds}} 秒が削除されます。書き出しはカット位置で飛びます。",
+ "zoomInJunction": "クリップのつなぎ目でズームインの {{seconds}} 秒が削除されます。書き出しはつなぎ目で飛びます。",
+ "zoomOutJunction": "クリップのつなぎ目でズームアウトの {{seconds}} 秒が削除されます。書き出しはつなぎ目で飛びます。",
"pan": "パン:画面がそのまま次のズームへ移動します"
},
"emptyState": {
diff --git a/src/i18n/locales/ko-KR/timeline.json b/src/i18n/locales/ko-KR/timeline.json
index d8f306083..64670c712 100644
--- a/src/i18n/locales/ko-KR/timeline.json
+++ b/src/i18n/locales/ko-KR/timeline.json
@@ -38,6 +38,8 @@
"zoomOut": "줌 아웃: 줌이 끝난 뒤 화면이 다시 축소됩니다",
"zoomInCut": "트림이 줌 인의 {{seconds}}초를 제거합니다. 내보내기는 컷 지점에서 건너뜁니다.",
"zoomOutCut": "트림이 줌 아웃의 {{seconds}}초를 제거합니다. 내보내기는 컷 지점에서 건너뜁니다.",
+ "zoomInJunction": "클립 연결 지점이 줌 인의 {{seconds}}초를 제거합니다. 내보내기는 연결 지점에서 건너뜁니다.",
+ "zoomOutJunction": "클립 연결 지점이 줌 아웃의 {{seconds}}초를 제거합니다. 내보내기는 연결 지점에서 건너뜁니다.",
"pan": "패닝: 화면이 바로 다음 줌으로 이동합니다"
},
"emptyState": {
diff --git a/src/i18n/locales/pt-BR/timeline.json b/src/i18n/locales/pt-BR/timeline.json
index a429bc00e..fee6e6933 100644
--- a/src/i18n/locales/pt-BR/timeline.json
+++ b/src/i18n/locales/pt-BR/timeline.json
@@ -38,6 +38,8 @@
"zoomOut": "Afastamento: a visão se afasta de novo após o fim do zoom",
"zoomInCut": "Um recorte remove {{seconds}} s da aproximação. A exportação salta no corte.",
"zoomOutCut": "Um recorte remove {{seconds}} s do afastamento. A exportação salta no corte.",
+ "zoomInJunction": "Uma junção entre clipes remove {{seconds}} s da aproximação. A exportação salta na junção.",
+ "zoomOutJunction": "Uma junção entre clipes remove {{seconds}} s do afastamento. A exportação salta na junção.",
"pan": "Panorâmica: a visão vai direto para o próximo zoom"
},
"emptyState": {
diff --git a/src/i18n/locales/ru/timeline.json b/src/i18n/locales/ru/timeline.json
index 9e722281f..f7ad39905 100644
--- a/src/i18n/locales/ru/timeline.json
+++ b/src/i18n/locales/ru/timeline.json
@@ -38,6 +38,8 @@
"zoomOut": "Отдаление: вид снова отдаляется после конца масштабирования",
"zoomInCut": "Обрезка удаляет {{seconds}} с приближения. В экспорте будет скачок на месте обрезки.",
"zoomOutCut": "Обрезка удаляет {{seconds}} с отдаления. В экспорте будет скачок на месте обрезки.",
+ "zoomInJunction": "Стык клипов удаляет {{seconds}} с приближения. В экспорте будет скачок на стыке.",
+ "zoomOutJunction": "Стык клипов удаляет {{seconds}} с отдаления. В экспорте будет скачок на стыке.",
"pan": "Панорама: вид сразу переходит к следующему масштабированию"
},
"emptyState": {
diff --git a/src/i18n/locales/tr/timeline.json b/src/i18n/locales/tr/timeline.json
index 25b57fc99..d0dae7ceb 100644
--- a/src/i18n/locales/tr/timeline.json
+++ b/src/i18n/locales/tr/timeline.json
@@ -38,6 +38,8 @@
"zoomOut": "Uzaklaşma: görüntü, yakınlaştırma bittikten sonra yeniden uzaklaşır",
"zoomInCut": "Bir kırpma, yakınlaşmanın {{seconds}} sn'sini kaldırır. Dışa aktarım kesimde atlar.",
"zoomOutCut": "Bir kırpma, uzaklaşmanın {{seconds}} sn'sini kaldırır. Dışa aktarım kesimde atlar.",
+ "zoomInJunction": "Bir klip birleşimi, yakınlaşmanın {{seconds}} sn'sini kaldırır. Dışa aktarım birleşimde atlar.",
+ "zoomOutJunction": "Bir klip birleşimi, uzaklaşmanın {{seconds}} sn'sini kaldırır. Dışa aktarım birleşimde atlar.",
"pan": "Kaydırma: görüntü doğrudan sonraki yakınlaştırmaya geçer"
},
"emptyState": {
diff --git a/src/i18n/locales/vi/timeline.json b/src/i18n/locales/vi/timeline.json
index 2aa6abd09..9baf8a115 100644
--- a/src/i18n/locales/vi/timeline.json
+++ b/src/i18n/locales/vi/timeline.json
@@ -38,6 +38,8 @@
"zoomOut": "Thu nhỏ: khung hình thu nhỏ lại sau khi kết thúc thu phóng",
"zoomInCut": "Một đoạn cắt xóa {{seconds}} giây của phần phóng to. Bản xuất sẽ nhảy tại điểm cắt.",
"zoomOutCut": "Một đoạn cắt xóa {{seconds}} giây của phần thu nhỏ. Bản xuất sẽ nhảy tại điểm cắt.",
+ "zoomInJunction": "Một điểm nối giữa các clip xóa {{seconds}} giây của phần phóng to. Bản xuất sẽ nhảy tại điểm nối.",
+ "zoomOutJunction": "Một điểm nối giữa các clip xóa {{seconds}} giây của phần thu nhỏ. Bản xuất sẽ nhảy tại điểm nối.",
"pan": "Lia máy: khung hình chuyển thẳng sang lần thu phóng tiếp theo"
},
"emptyState": {
diff --git a/src/i18n/locales/zh-CN/timeline.json b/src/i18n/locales/zh-CN/timeline.json
index f498c359a..b97d25729 100644
--- a/src/i18n/locales/zh-CN/timeline.json
+++ b/src/i18n/locales/zh-CN/timeline.json
@@ -38,6 +38,8 @@
"zoomOut": "缩小过程:画面在缩放结束后逐渐恢复",
"zoomInCut": "剪辑移除了放大过程的 {{seconds}} 秒。导出时画面会在剪切处跳变。",
"zoomOutCut": "剪辑移除了缩小过程的 {{seconds}} 秒。导出时画面会在剪切处跳变。",
+ "zoomInJunction": "片段衔接处移除了放大过程的 {{seconds}} 秒。导出时画面会在衔接处跳变。",
+ "zoomOutJunction": "片段衔接处移除了缩小过程的 {{seconds}} 秒。导出时画面会在衔接处跳变。",
"pan": "平移:画面直接移到下一个缩放"
},
"emptyState": {
diff --git a/src/i18n/locales/zh-TW/timeline.json b/src/i18n/locales/zh-TW/timeline.json
index 34ace2112..ed255420b 100644
--- a/src/i18n/locales/zh-TW/timeline.json
+++ b/src/i18n/locales/zh-TW/timeline.json
@@ -38,6 +38,8 @@
"zoomOut": "縮小過程:畫面在縮放結束後逐漸恢復",
"zoomInCut": "剪輯移除了放大過程的 {{seconds}} 秒。匯出時畫面會在剪切處跳動。",
"zoomOutCut": "剪輯移除了縮小過程的 {{seconds}} 秒。匯出時畫面會在剪切處跳動。",
+ "zoomInJunction": "片段銜接處移除了放大過程的 {{seconds}} 秒。匯出時畫面會在銜接處跳動。",
+ "zoomOutJunction": "片段銜接處移除了縮小過程的 {{seconds}} 秒。匯出時畫面會在銜接處跳動。",
"pan": "平移:畫面直接移到下一個縮放"
},
"emptyState": {
diff --git a/src/lib/ai-edition/timeline/zoom-transitions.test.ts b/src/lib/ai-edition/timeline/zoom-transitions.test.ts
index 8d05e8e97..738fee68c 100644
--- a/src/lib/ai-edition/timeline/zoom-transitions.test.ts
+++ b/src/lib/ai-edition/timeline/zoom-transitions.test.ts
@@ -59,11 +59,48 @@ describe("transitionCutsMs", () => {
});
it("ignores trims clear of the windows, inside the pill, or swallowing the whole zoom", () => {
- const none = { inMs: 0, outMs: 0 };
+ const none = { inMs: 0, outMs: 0, inByJunction: false, outByJunction: false };
expect(transitionCutsMs(zoom, t, [{ startMs: 13_000, endMs: 14_000 }])).toEqual(none);
expect(transitionCutsMs(zoom, t, [{ startMs: 10_500, endMs: 11_000 }])).toEqual(none);
expect(transitionCutsMs(zoom, t, [{ startMs: 9000, endMs: 14_000 }])).toEqual(none);
});
+
+ it("loses the whole move to a cut touching the pill's edge, the segment it ends", () => {
+ expect(transitionCutsMs(zoom, t, [{ startMs: 11_000, endMs: 12_000 }]).outMs).toBeCloseTo(W, 6);
+ expect(transitionCutsMs(zoom, t, [{ startMs: 10_000, endMs: 11_000 }]).inMs).toBeCloseTo(W, 6);
+ });
+
+ it("counts a clip junction as a zero-length cut, and says so (issue #1028)", () => {
+ const at = (ms: number) => [{ startMs: ms, endMs: ms }];
+ expect(transitionCutsMs(zoom, t, [], at(12_500))).toEqual({
+ inMs: 0,
+ outMs: expect.closeTo(12_000 + W - 12_500, 6),
+ inByJunction: false,
+ outByJunction: true,
+ });
+ expect(transitionCutsMs(zoom, t, [], at(9500))).toMatchObject({
+ inMs: expect.closeTo(9500 - (10_000 - W), 6),
+ inByJunction: true,
+ });
+ expect(transitionCutsMs(zoom, t, [], at(12_000)).outMs).toBeCloseTo(W, 6);
+ expect(transitionCutsMs(zoom, t, [], at(10_000)).inMs).toBeCloseTo(W, 6);
+ const none = { inMs: 0, outMs: 0, inByJunction: false, outByJunction: false };
+ expect(transitionCutsMs(zoom, t, [], at(12_000 + W))).toEqual(none);
+ expect(transitionCutsMs(zoom, t, [], at(10_000 - W))).toEqual(none);
+ });
+
+ it("blames the cut nearest the pill, where the export jumps", () => {
+ const trim = [{ startMs: 12_600, endMs: 13_500 }];
+ const junction = (ms: number) => [{ startMs: ms, endMs: ms }];
+ expect(transitionCutsMs(zoom, t, trim, junction(12_300))).toMatchObject({
+ outMs: expect.closeTo(12_000 + W - 12_300, 6),
+ outByJunction: true,
+ });
+ expect(transitionCutsMs(zoom, t, trim, junction(12_800))).toMatchObject({
+ outMs: expect.closeTo(12_000 + W - 12_600, 6),
+ outByJunction: false,
+ });
+ });
});
describe("chainedPans", () => {
diff --git a/src/lib/ai-edition/timeline/zoom-transitions.ts b/src/lib/ai-edition/timeline/zoom-transitions.ts
index 95d03520b..3a2eec58f 100644
--- a/src/lib/ai-edition/timeline/zoom-transitions.ts
+++ b/src/lib/ai-edition/timeline/zoom-transitions.ts
@@ -2,13 +2,14 @@
// zoom-in runs entirely before its start and the zoom-out entirely after its end, each
// lasting `zoomTransitionMs(scale)` of SCREEN time (`computeRegionStrength`, mirror of
// `zoom_region_strength` in crates/compositor/src/regions.rs). These helpers turn those
-// windows into timeline ms, through the same speed-aware clock, and measure what a trim cuts
-// off them: the render drops the trimmed frames, so the camera jumps at the cut instead of
-// easing.
+// windows into timeline ms, through the same speed-aware clock, and measure what a trim or a
+// clip junction cuts off them: the render drops the trimmed frames and renders each clip on
+// its own, so the camera jumps at the cut instead of easing.
//
// Chained zooms (closer than 1.5 s on screen) have no zoom-out and zoom-in between them: the
-// camera pans from one to the other instead (`chainedPans`). A trim between two zooms splits
-// them into separate segments, which breaks the chain, so each then has its own windows.
+// camera pans from one to the other instead (`chainedPans`). A trim or a junction between two
+// zooms splits them into separate segments, which breaks the chain, so each then has its own
+// windows.
import {
CHAINED_ZOOM_PAN_GAP_MS,
@@ -54,30 +55,49 @@ export function zoomTransitions(
}
/**
- * Timeline ms of each move the trims cut off (0 when untouched). The zoom-in only plays after
- * the last trimmed instant before the zoom, the zoom-out only until the first one after it.
- * A zoom entirely under a trim never plays and the compositor renders it without envelopes
- * (`under_trim`), so it has nothing to cut.
+ * Timeline ms of each move the cuts take off (0 when untouched), and whether a clip junction
+ * rather than a trim is the cut that does it. The compositor renders each clip segment on its
+ * own and gives a zoom only to the segments it overlaps, so the zoom-in only plays after the
+ * last cut before the zoom and the zoom-out only until the first one after it, a cut touching
+ * the pill's edge included. A junction is a zero-length cut. A zoom entirely under a trim
+ * never plays and the compositor renders it without envelopes (`under_trim`), so it has
+ * nothing to cut.
*/
export function transitionCutsMs(
zoom: Span,
transitions: ZoomTransitions,
trims: readonly Span[],
-): { inMs: number; outMs: number } {
- if (trims.some((t) => t.startMs <= zoom.startMs && t.endMs >= zoom.endMs)) {
- return { inMs: 0, outMs: 0 };
- }
+ junctions: readonly Span[] = [],
+): { inMs: number; outMs: number; inByJunction: boolean; outByJunction: boolean } {
let resumesAt = transitions.inFromMs;
let jumpsAt = transitions.outUntilMs;
- for (const t of trims) {
- if (t.startMs < zoom.startMs && t.endMs > transitions.inFromMs) {
- resumesAt = Math.max(resumesAt, Math.min(t.endMs, zoom.startMs));
- }
- if (t.endMs > zoom.endMs && t.startMs < transitions.outUntilMs) {
- jumpsAt = Math.min(jumpsAt, Math.max(t.startMs, zoom.endMs));
+ let inByJunction = false;
+ let outByJunction = false;
+ if (!trims.some((t) => t.startMs <= zoom.startMs && t.endMs >= zoom.endMs)) {
+ for (const [cuts, junction] of [
+ [trims, false],
+ [junctions, true],
+ ] as const) {
+ for (const c of cuts) {
+ const resumes = Math.min(c.endMs, zoom.startMs);
+ if (c.startMs <= zoom.startMs && resumes > resumesAt) {
+ resumesAt = resumes;
+ inByJunction = junction;
+ }
+ const jumps = Math.max(c.startMs, zoom.endMs);
+ if (c.endMs >= zoom.endMs && jumps < jumpsAt) {
+ jumpsAt = jumps;
+ outByJunction = junction;
+ }
+ }
}
}
- return { inMs: resumesAt - transitions.inFromMs, outMs: transitions.outUntilMs - jumpsAt };
+ return {
+ inMs: resumesAt - transitions.inFromMs,
+ outMs: transitions.outUntilMs - jumpsAt,
+ inByJunction,
+ outByJunction,
+ };
}
export interface ChainedPan {
diff --git a/technical-documentation/architecture/ai-agent.md b/technical-documentation/architecture/ai-agent.md
index e6b9992e5..180402381 100644
--- a/technical-documentation/architecture/ai-agent.md
+++ b/technical-documentation/architecture/ai-agent.md
@@ -45,10 +45,10 @@ The model never free-writes the project document. It can only call the fixed set
| Tool | What it does | What it mutates |
|---|---|---|
-| `getCurrentDocument` | Reads a compact project, asset, clip, trim, and modifier snapshot with explicit time bases. Each asset reports `hasCameraTrack` / `cameraVisible` / `hasCursorTelemetry` beside `hasTranscript` (`hasCursorTelemetry` is three-valued: `true`, `false` when the asset was checked and has none, `null` when it was not checked — never `false` for something we failed to look at), the document reports `hasAnyCamera` and `autoFocusAll`, and each zoom reports the `renderedScale` the viewer will see plus `customScale` / `depthIsOverridden` when a custom scale makes its `depth` inert. Each zoom also reports where its camera moves sit on the ruler, outside the pill: `zoomInFromSec`, `zoomOutUntilSec` (speed-aware, from `zoomTransitions` in `src/lib/ai-edition/timeline/zoom-transitions.ts`), `transitionSec`, and `cutByTrim` (`in` / `out` / `both`) when a trim cuts a move, so the export jumps there (#1028). Chained zooms (at most 1.5 s apart on screen, no trim or clip junction between them) report the pan instead: `panToZoomId` / `panUntilSec` on the first, `panFromZoomId` on the second, in place of its zoom-out and zoom-in (`chainedPans`). | Nothing. |
+| `getCurrentDocument` | Reads a compact project, asset, clip, trim, and modifier snapshot with explicit time bases. Each asset reports `hasCameraTrack` / `cameraVisible` / `hasCursorTelemetry` beside `hasTranscript` (`hasCursorTelemetry` is three-valued: `true`, `false` when the asset was checked and has none, `null` when it was not checked — never `false` for something we failed to look at), the document reports `hasAnyCamera` and `autoFocusAll`, and each zoom reports the `renderedScale` the viewer will see plus `customScale` / `depthIsOverridden` when a custom scale makes its `depth` inert. Each zoom also reports where its camera moves sit on the ruler, outside the pill: `zoomInFromSec`, `zoomOutUntilSec` (speed-aware, from `zoomTransitions` in `src/lib/ai-edition/timeline/zoom-transitions.ts`), `transitionSec`, `cutByTrim` (`in` / `out` / `both`) when a trim cuts a move, and `cutByJunction` when a clip junction does (the compositor renders each clip on its own, so a move running past its clip's edge is lost too), so the export jumps there (#1028). A side cut by both is blamed on the cut nearest the pill, where the jump is. Chained zooms (at most 1.5 s apart on screen, no trim or clip junction between them) report the pan instead: `panToZoomId` / `panUntilSec` on the first, `panFromZoomId` on the second, in place of its zoom-out and zoom-in (`chainedPans`). | Nothing. |
| `getTranscript` | Reads the transcript segments for an asset, or the primary asset, in full. On the production path a segment is one word, so a half-hour recording is a few thousand of them — there is no cap, and no per-model context budget to derive one from. | Nothing. |
| `getCursorTrack` | Reads the recorded pointer telemetry for an asset as REAL SAMPLES, reduced per axis against time (Douglas–Peucker) rather than summarised: every point returned is one that was recorded, carrying its source `atSec`, `cx`/`cy`, the `virtualSec` that `addZoom` takes (left off the points, with `virtualEqualsSource` on the envelope, when the two coincide everywhere), a `shape` index per distinct pointer bitmap, and `kind` / `trimmed` where they apply. Answers `available:false` with `reason:"no-sidecar"` (checked, this asset has none) or `reason:"unavailable"` (could not be read from here), and the two are never conflated. | Nothing. |
-| `addTrim` | Adds one source-time cut inside a clip. Like the zoom writes and `setTrim`, it reports `cutTransitions` (zoom, side, seconds lost) when the edit newly cuts a zoom's move in or out; a warning, never a refusal. | `timeline.trimRanges`. |
+| `addTrim` | Adds one source-time cut inside a clip. Like the zoom writes and `setTrim`, it reports `cutTransitions` (zoom, side, seconds lost, `by` trim or junction) when the edit newly cuts a zoom's move in or out; a warning, never a refusal. | `timeline.trimRanges`. |
| `addTrims` | Adds many cuts in one call, replaying `addTrim` per entry so the rules cannot drift apart. Each range stands alone: one that cannot be placed is refused by itself and named with its index and reason while the rest are applied, and the result leads with `requested` / `appliedCount` / `refusedCount`. Only a batch where nothing landed is an error. | `timeline.trimRanges`. |
| `setTrim` | Moves or resizes an existing source-time trim. | The matching `timeline.trimRanges` entry. |
| `setClipRange` | Changes a clip's source in/out points and relays clips back-to-back. | The clip range and any anchored regions clamped or removed by the shared timeline mutator. |