Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.
TypeScript cross-platformelectronffmpegopen-sourceproduct-demorustscreen-capturescreen-recorderscreen-recordingscreen-studioscreencastspeech-to-texttypescriptvideo-editingvideo-editorwaylandwgpuwhisper
feat(timeline): show and report the pan between chained zooms (#1028)
EtienneLescot6bf306058d3c
diff --git a/electron/ai-edition/agent-tools.test.ts b/electron/ai-edition/agent-tools.test.tsindex 4bad12b91..5b7c37174 100644--- a/electron/ai-edition/agent-tools.test.ts+++ b/electron/ai-edition/agent-tools.test.ts@@ -2605,6 +2605,56 @@ describe("zoom transitions are reported, not hidden (#1028)", () => {]);});+ it("reports two zooms closer than 1.5 s as one pan, not a zoom-out and back in", () => {+ const chained = run(zoomedAt10to12().document, "addZoom", {+ startSec: 12.5,+ endSec: 14,+ depth: 3,+ });+ const [first, second] = run(chained.document, "getCurrentDocument", {}).payload.zoomRanges;+ expect(first).toMatchObject({ panToZoomId: second.id, panUntilSec: 13 });+ expect(first.zoomOutUntilSec).toBeUndefined();+ expect(first.zoomInFromSec).toBe(10 - MOVE_SEC);+ expect(second.panFromZoomId).toBe(first.id);+ expect(second.zoomInFromSec).toBeUndefined();+ expect(second.zoomOutUntilSec).toBe(14 + MOVE_SEC);+ });++ it("warns of both moves when a trim between two chained zooms breaks the chain", () => {+ const chained = run(zoomedAt10to12().document, "addZoom", {+ startSec: 12.5,+ endSec: 14,+ depth: 3,+ });+ const trimmed = run(chained.document, "addTrim", { startSec: 12, endSec: 12.5 });+ 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 },+ ]);+ });++ it("does not chain zooms across a clip junction", () => {+ const base = shortSingleClip();+ const clip = base.timeline.clips[0];+ const twoClips: AxcutDocument = {+ ...base,+ timeline: {+ ...base.timeline,+ clips: [+ { ...clip, sourceEndSec: 12, timelineEndSec: 12 },+ { ...clip, id: "clip_2", sourceStartSec: 12, timelineStartSec: 12 },+ ],+ },+ };+ const first = run(twoClips, "addZoom", { startSec: 10, endSec: 12, depth: 3 });+ const both = run(first.document, "addZoom", { startSec: 12.5, endSec: 14, depth: 3 });+ const zooms = run(both.document, "getCurrentDocument", {}).payload.zoomRanges;+ expect(zooms[0].panToZoomId).toBeUndefined();+ expect(zooms[0].zoomOutUntilSec).toBe(12 + MOVE_SEC);+ });+it("stretches the zoom-out across a speed region, and catches a trim placed there", () => {const sped = run(zoomedAt10to12().document, "addSpeed", { startSec: 12, endSec: 20, speed: 3 });expect(snapshotZoom(sped.document).zoomOutUntilSec).toBe(14.77);diff --git a/electron/ai-edition/agent-tools.ts b/electron/ai-edition/agent-tools.tsindex b8ffb68a4..3a94ccdab 100644--- a/electron/ai-edition/agent-tools.ts+++ b/electron/ai-edition/agent-tools.ts@@ -61,6 +61,7 @@ import {ZOOM_DEPTH_LEGEND,} from "../../src/lib/ai-edition/timeline/zoom-scale";import {+ chainedPans,transitionCutsMs,zoomTransitions,} from "../../src/lib/ai-edition/timeline/zoom-transitions";@@ -743,9 +744,26 @@ function zoomTransitionsForAgent(document: AxcutDocument) {return span ? [{ startMs: span.start * 1000, endMs: span.end * 1000 }] : [];});});- return coalesceForAgent(document.zoomRanges).map((zoom) => {+ // 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).+ const zooms = coalesceForAgent(document.zoomRanges);+ const junctions = document.timeline.clips.map((clip) => ({+ startMs: clip.timelineEndSec * 1000,+ endMs: clip.timelineEndSec * 1000,+ }));+ const pans = chainedPans(zooms, speedRegions, [...trims, ...junctions]);+ return zooms.map((zoom, i) => {const transitions = zoomTransitions({ ...zoom, scale: effectiveZoomScale(zoom) }, speedRegions);- return { zoom, transitions, cut: transitionCutsMs(zoom, transitions, trims) };+ const panOut = pans.find((p) => p.from === i);+ const panIn = pans.find((p) => p.to === i);+ const cut = transitionCutsMs(zoom, transitions, trims);+ return {+ zoom,+ transitions,+ 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,+ };});}@@ -824,7 +842,10 @@ 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): 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).",project: { id: document.project.id, title: document.project.title },primaryAssetId: document.project.primaryAssetId ?? document.assets[0]?.id ?? null,autoFocusAll,@@ -881,27 +902,31 @@ export function documentSnapshotForModel(endSec: s.endSec,reason: s.reason,})),- zoomRanges: zoomTransitionsForAgent(document).map(({ zoom: z, transitions, cut }) => ({- id: z.id,- startSec: roundSec(z.startMs),- endSec: roundSec(z.endMs),- zoomInFromSec: roundSec(transitions.inFromMs),- zoomOutUntilSec: roundSec(transitions.outUntilMs),- transitionSec: roundSec(transitions.durationMs),- ...(cut.inMs > 0 || cut.outMs > 0- ? { cutByTrim: cut.inMs > 0 ? (cut.outMs > 0 ? "both" : "in") : "out" }- : {}),- depth: z.depth,- renderedScale: effectiveZoomScale(z),- // Emitted only when set: an unconditional `customScale: null` on every- // zoom of every snapshot is noise the reader learns to skip, which is- // how the field would go unnoticed again.- ...(z.customScale != null ? { customScale: z.customScale, depthIsOverridden: true } : {}),- ...(z.rotationPreset ? { rotationPreset: z.rotationPreset } : {}),- focus: z.focus,- focusMode: autoFocusAll ? "auto" : (z.focusMode ?? "manual"),- source: z.source ?? "manual",- })),+ zoomRanges: zoomTransitionsForAgent(document).map(+ ({ zoom: z, transitions, cut, panTo, panFromZoomId }) => ({+ id: z.id,+ startSec: roundSec(z.startMs),+ endSec: roundSec(z.endMs),+ ...(panFromZoomId ? { panFromZoomId } : { zoomInFromSec: roundSec(transitions.inFromMs) }),+ ...(panTo+ ? { 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" }+ : {}),+ depth: z.depth,+ renderedScale: effectiveZoomScale(z),+ // Emitted only when set: an unconditional `customScale: null` on every+ // zoom of every snapshot is noise the reader learns to skip, which is+ // how the field would go unnoticed again.+ ...(z.customScale != null ? { customScale: z.customScale, depthIsOverridden: true } : {}),+ ...(z.rotationPreset ? { rotationPreset: z.rotationPreset } : {}),+ focus: z.focus,+ focusMode: autoFocusAll ? "auto" : (z.focusMode ?? "manual"),+ source: z.source ?? "manual",+ }),+ ),speedRegions: coalesceForAgent(speedRegions).map((s) => ({id: s.id,startSec: roundSec(s.startMs),diff --git a/electron/ai-edition/deep-agent/service.ts b/electron/ai-edition/deep-agent/service.tsindex b7924e870..8281d52df 100644--- a/electron/ai-edition/deep-agent/service.ts+++ b/electron/ai-edition/deep-agent/service.ts@@ -145,7 +145,7 @@ export function buildSystemPrompt(options: { editsAllowed: boolean }): string {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.`;+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.`;export const TOOL_DESCRIPTIONS: Record<string, string> = {diff --git a/src/components/ai-edition/v4/EditorShellV4.module.css b/src/components/ai-edition/v4/EditorShellV4.module.cssindex f22c2d1ca..862ac1c68 100644--- a/src/components/ai-edition/v4/EditorShellV4.module.css+++ b/src/components/ai-edition/v4/EditorShellV4.module.css@@ -1684,6 +1684,10 @@border-radius: 0 7px 7px 0;background: linear-gradient(90deg, color-mix(in oklab, var(--_c) 55%, transparent), transparent);}+/* The pan between chained zooms: the camera moves the whole way, so no fade. */+.zoomTrail[data-zoom-trail="pan"] {+ background: color-mix(in oklab, var(--_c) 40%, transparent);+}.zoomTrailCut {position: absolute;top: 0;diff --git a/src/components/ai-edition/v4/V4Timeline.geometry.test.tsx b/src/components/ai-edition/v4/V4Timeline.geometry.test.tsxindex 9429043ab..e5e717e52 100644--- a/src/components/ai-edition/v4/V4Timeline.geometry.test.tsx+++ b/src/components/ai-edition/v4/V4Timeline.geometry.test.tsx@@ -1094,7 +1094,7 @@ describe("V4Timeline zoom trails", () => {const W_SEC = zoomTransitionMs(1.8) / 1000; // ≈ 0.92 s at the default depthconst ZOOM = { id: "z1", startMs: 10_000, endMs: 12_000, depth: 3 };const pct = (sec: number) => (sec / TOTAL_SEC) * 100;- const trail = (side: "in" | "out") =>+ const trail = (side: "in" | "out" | "pan") =>document.querySelector<HTMLElement>(`[data-zoom-trail="${side}"]`) as HTMLElement;function renderZoom(overrides: Record<string, unknown>) {@@ -1125,6 +1125,16 @@ describe("V4Timeline zoom trails", () => {expect(Number.parseFloat(cut?.style.width ?? "")).toBeCloseTo(100, 6);});+ 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]")];+ expect(trails.map((el) => el.dataset.zoomTrail)).toEqual(["in", "pan", "out"]);+ const pan = trail("pan");+ expect(pan).toHaveAccessibleName("Pan: the view moves straight to the next zoom");+ expect(Number.parseFloat(pan.style.left)).toBeCloseTo(pct(12), 6);+ expect(Number.parseFloat(pan.style.width)).toBeCloseTo(pct(1), 6);+ });+it("stretches the zoom-out across a speed region, uncut", () => {renderZoom({ speedRegions: [{ id: "s1", startMs: 12_000, endMs: 20_000, speed: 3 }] });expect(Number.parseFloat(trail("out").style.width)).toBeCloseTo(pct(3 * W_SEC), 6);diff --git a/src/components/ai-edition/v4/V4Timeline.tsx b/src/components/ai-edition/v4/V4Timeline.tsxindex a27e28ea2..8f8bce9b4 100644--- a/src/components/ai-edition/v4/V4Timeline.tsx+++ b/src/components/ai-edition/v4/V4Timeline.tsx@@ -68,7 +68,11 @@ import {ventilateTimelineSpanToTrims,} from "@/lib/ai-edition/timeline/trim-mapping";import { effectiveZoomScale } from "@/lib/ai-edition/timeline/zoom-scale";-import { transitionCutsMs, zoomTransitions } from "@/lib/ai-edition/timeline/zoom-transitions";+import {+ chainedPans,+ transitionCutsMs,+ zoomTransitions,+} from "@/lib/ai-edition/timeline/zoom-transitions";import { formatBinding } from "@/lib/shortcuts";import { nativeBridgeClient } from "@/native/client";import { TransportBar } from "../TransportBar";@@ -1838,8 +1842,9 @@ 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. Display- // only, not a control. Hidden while a clip is dragged, when the pills split and slide.+ // uses. The part a trim cuts is hatched: the export jumps there instead of easing. 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 = () => {if (clipDrag) return null;const ms = (span: { start: number; end: number }) => ({@@ -1854,32 +1859,46 @@ export function V4Timeline({const trims = trimPills.map((p) => ms(liveSpan(p.id, p)));const totalMs = total * 1000;const sec = (cutMs: number) => (cutMs / 1000).toFixed(2);- return zoomRuns.flatMap((r) => {- const zoom = ms(liveSpan(r.ids[0], r));+ const zooms = zoomRuns.map((r) => ms(liveSpan(r.ids[0], r)));+ const junctions = clips.map((c) => ms({ start: c.timelineEndSec, end: c.timelineEndSec }));+ 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 outUntilMs = Math.min(moves.outUntilMs, totalMs);+ const zoomIn = {+ side: "in",+ fromMs: moves.inFromMs,+ 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"),+ };const trails = [- {- side: "in",- fromMs: moves.inFromMs,- 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"),- },- {- side: "out",- fromMs: zoom.endMs,- toMs: outUntilMs,- cutFromMs: moves.outUntilMs - cut.outMs,- cutToMs: outUntilMs,- text:- cut.outMs > 0- ? t("trails.zoomOutCut", { seconds: sec(cut.outMs) })- : t("trails.zoomOut"),- },+ ...(panned ? [] : [zoomIn]),+ pan+ ? {+ side: "pan",+ fromMs: zoom.endMs,+ toMs: Math.min(pan.untilMs, totalMs),+ cutFromMs: 0,+ cutToMs: 0,+ text: t("trails.pan"),+ }+ : {+ side: "out",+ fromMs: zoom.endMs,+ toMs: outUntilMs,+ cutFromMs: moves.outUntilMs - cut.outMs,+ cutToMs: outUntilMs,+ text:+ cut.outMs > 0+ ? t("trails.zoomOutCut", { seconds: sec(cut.outMs) })+ : t("trails.zoomOut"),+ },];return trails.filter((trail) => trail.toMs > trail.fromMs)diff --git a/src/i18n/__tests__/tooltipCopy.test.ts b/src/i18n/__tests__/tooltipCopy.test.tsindex 22257822b..4b503cf50 100644--- a/src/i18n/__tests__/tooltipCopy.test.ts+++ b/src/i18n/__tests__/tooltipCopy.test.ts@@ -42,7 +42,13 @@ const TOOLTIP_KEYS: Record<string, string[]> = {"deviceSettings.title","deviceSettings.close",],- timeline: ["trails.zoomIn", "trails.zoomOut", "trails.zoomInCut", "trails.zoomOutCut"],+ timeline: [+ "trails.zoomIn",+ "trails.zoomOut",+ "trails.zoomInCut",+ "trails.zoomOutCut",+ "trails.pan",+ ],};function read(locale: string, namespace: string, key: string): string {diff --git a/src/i18n/locales/ar/timeline.json b/src/i18n/locales/ar/timeline.jsonindex 9eb9cf6a9..16ebbd06e 100644--- a/src/i18n/locales/ar/timeline.json+++ b/src/i18n/locales/ar/timeline.json@@ -37,7 +37,8 @@"zoomIn": "التكبير التدريجي: تقترب الصورة حتى بداية التكبير","zoomOut": "التصغير التدريجي: تبتعد الصورة مجددًا بعد نهاية التكبير","zoomInCut": "يزيل قص {{seconds}} ث من التكبير التدريجي. يقفز التصدير عند القص.",- "zoomOutCut": "يزيل قص {{seconds}} ث من التصغير التدريجي. يقفز التصدير عند القص."+ "zoomOutCut": "يزيل قص {{seconds}} ث من التصغير التدريجي. يقفز التصدير عند القص.",+ "pan": "تحريك: تنتقل الصورة مباشرة إلى التكبير التالي"},"emptyState": {"noVideo": "لم يتم تحميل أي فيديو",diff --git a/src/i18n/locales/cs/timeline.json b/src/i18n/locales/cs/timeline.jsonindex f1092ec2b..157183fb8 100644--- a/src/i18n/locales/cs/timeline.json+++ b/src/i18n/locales/cs/timeline.json@@ -37,7 +37,8 @@"zoomIn": "Najetí: pohled se přibližuje až do začátku přiblížení","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čí."+ "zoomOutCut": "Oříznutí odstraní {{seconds}} s oddálení. Export v místě střihu skočí.",+ "pan": "Posun: pohled přejede rovnou na další přiblížení"},"emptyState": {"noVideo": "Žádné video nenačteno",diff --git a/src/i18n/locales/de/timeline.json b/src/i18n/locales/de/timeline.jsonindex 819fcb947..5ed9cea9c 100644--- a/src/i18n/locales/de/timeline.json+++ b/src/i18n/locales/de/timeline.json@@ -37,7 +37,8 @@"zoomIn": "Hineinzoomen: Die Ansicht zoomt bis zum Beginn des Zooms hinein","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."+ "zoomOutCut": "Ein Trim entfernt {{seconds}} s des Herauszoomens. Der Export springt am Schnitt.",+ "pan": "Schwenk: Die Ansicht fährt direkt zum nächsten Zoom"},"emptyState": {"noVideo": "Kein Video geladen",diff --git a/src/i18n/locales/en/timeline.json b/src/i18n/locales/en/timeline.jsonindex b74827885..955a0e515 100644--- a/src/i18n/locales/en/timeline.json+++ b/src/i18n/locales/en/timeline.json@@ -37,7 +37,8 @@"zoomIn": "Zoom-in: the view moves in until the zoom starts","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."+ "zoomOutCut": "A trim removes {{seconds}} s of the zoom-out. The export jumps at the cut.",+ "pan": "Pan: the view moves straight to the next zoom"},"emptyState": {"noVideo": "No video loaded",diff --git a/src/i18n/locales/es/timeline.json b/src/i18n/locales/es/timeline.jsonindex 972f409b4..a626aeada 100644--- a/src/i18n/locales/es/timeline.json+++ b/src/i18n/locales/es/timeline.json@@ -37,7 +37,8 @@"zoomIn": "Acercamiento: la vista se acerca hasta que empieza el zoom","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."+ "zoomOutCut": "Un recorte quita {{seconds}} s del alejamiento. La exportación salta en el corte.",+ "pan": "Paneo: la vista pasa directamente al siguiente zoom"},"emptyState": {"noVideo": "No hay video cargado",diff --git a/src/i18n/locales/fr/timeline.json b/src/i18n/locales/fr/timeline.jsonindex 968ec2b7e..303543735 100644--- a/src/i18n/locales/fr/timeline.json+++ b/src/i18n/locales/fr/timeline.json@@ -37,7 +37,8 @@"zoomIn": "Zoom avant : l'image se resserre jusqu'au début du zoom","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."+ "zoomOutCut": "Une coupe retire {{seconds}} s du zoom arrière. L'export saute à la coupe.",+ "pan": "Panoramique : l'image glisse directement vers le zoom suivant"},"emptyState": {"noVideo": "Aucune vidéo chargée",diff --git a/src/i18n/locales/it/timeline.json b/src/i18n/locales/it/timeline.jsonindex 66eb38152..06713fa1b 100644--- a/src/i18n/locales/it/timeline.json+++ b/src/i18n/locales/it/timeline.json@@ -37,7 +37,8 @@"zoomIn": "Zoom in: la vista si avvicina fino all'inizio dello zoom","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."+ "zoomOutCut": "Un taglio rimuove {{seconds}} s dello zoom out. L'esportazione salta al taglio.",+ "pan": "Panoramica: la vista si sposta direttamente allo zoom successivo"},"emptyState": {"noVideo": "Nessun video caricato",diff --git a/src/i18n/locales/ja-JP/timeline.json b/src/i18n/locales/ja-JP/timeline.jsonindex 1a7cbb038..adebdc04b 100644--- a/src/i18n/locales/ja-JP/timeline.json+++ b/src/i18n/locales/ja-JP/timeline.json@@ -37,7 +37,8 @@"zoomIn": "ズームイン:ズームの開始まで画面が拡大していきます","zoomOut": "ズームアウト:ズームの終了後に画面が元に戻ります","zoomInCut": "トリムでズームインの {{seconds}} 秒が削除されます。書き出しはカット位置で飛びます。",- "zoomOutCut": "トリムでズームアウトの {{seconds}} 秒が削除されます。書き出しはカット位置で飛びます。"+ "zoomOutCut": "トリムでズームアウトの {{seconds}} 秒が削除されます。書き出しはカット位置で飛びます。",+ "pan": "パン:画面がそのまま次のズームへ移動します"},"emptyState": {"noVideo": "ビデオが読み込まれていません",diff --git a/src/i18n/locales/ko-KR/timeline.json b/src/i18n/locales/ko-KR/timeline.jsonindex 668838700..d8f306083 100644--- a/src/i18n/locales/ko-KR/timeline.json+++ b/src/i18n/locales/ko-KR/timeline.json@@ -37,7 +37,8 @@"zoomIn": "줌 인: 줌이 시작될 때까지 화면이 확대됩니다","zoomOut": "줌 아웃: 줌이 끝난 뒤 화면이 다시 축소됩니다","zoomInCut": "트림이 줌 인의 {{seconds}}초를 제거합니다. 내보내기는 컷 지점에서 건너뜁니다.",- "zoomOutCut": "트림이 줌 아웃의 {{seconds}}초를 제거합니다. 내보내기는 컷 지점에서 건너뜁니다."+ "zoomOutCut": "트림이 줌 아웃의 {{seconds}}초를 제거합니다. 내보내기는 컷 지점에서 건너뜁니다.",+ "pan": "패닝: 화면이 바로 다음 줌으로 이동합니다"},"emptyState": {"noVideo": "불러온 비디오 없음",diff --git a/src/i18n/locales/pt-BR/timeline.json b/src/i18n/locales/pt-BR/timeline.jsonindex 2504471de..a429bc00e 100644--- a/src/i18n/locales/pt-BR/timeline.json+++ b/src/i18n/locales/pt-BR/timeline.json@@ -37,7 +37,8 @@"zoomIn": "Aproximação: a visão se aproxima até o início do zoom","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."+ "zoomOutCut": "Um recorte remove {{seconds}} s do afastamento. A exportação salta no corte.",+ "pan": "Panorâmica: a visão vai direto para o próximo zoom"},"emptyState": {"noVideo": "Nenhum Vídeo Carregado",diff --git a/src/i18n/locales/ru/timeline.json b/src/i18n/locales/ru/timeline.jsonindex f679acf83..9e722281f 100644--- a/src/i18n/locales/ru/timeline.json+++ b/src/i18n/locales/ru/timeline.json@@ -37,7 +37,8 @@"zoomIn": "Приближение: вид приближается до начала масштабирования","zoomOut": "Отдаление: вид снова отдаляется после конца масштабирования","zoomInCut": "Обрезка удаляет {{seconds}} с приближения. В экспорте будет скачок на месте обрезки.",- "zoomOutCut": "Обрезка удаляет {{seconds}} с отдаления. В экспорте будет скачок на месте обрезки."+ "zoomOutCut": "Обрезка удаляет {{seconds}} с отдаления. В экспорте будет скачок на месте обрезки.",+ "pan": "Панорама: вид сразу переходит к следующему масштабированию"},"emptyState": {"noVideo": "Видео не загружено",diff --git a/src/i18n/locales/tr/timeline.json b/src/i18n/locales/tr/timeline.jsonindex c25690bd3..25b57fc99 100644--- a/src/i18n/locales/tr/timeline.json+++ b/src/i18n/locales/tr/timeline.json@@ -37,7 +37,8 @@"zoomIn": "Yakınlaşma: görüntü, yakınlaştırma başlayana kadar yaklaşır","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."+ "zoomOutCut": "Bir kırpma, uzaklaşmanın {{seconds}} sn'sini kaldırır. Dışa aktarım kesimde atlar.",+ "pan": "Kaydırma: görüntü doğrudan sonraki yakınlaştırmaya geçer"},"emptyState": {"noVideo": "Video Yüklenmedi",diff --git a/src/i18n/locales/vi/timeline.json b/src/i18n/locales/vi/timeline.jsonindex ff52458f2..2aa6abd09 100644--- a/src/i18n/locales/vi/timeline.json+++ b/src/i18n/locales/vi/timeline.json@@ -37,7 +37,8 @@"zoomIn": "Phóng to: khung hình phóng to dần cho đến khi bắt đầu thu phóng","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."+ "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.",+ "pan": "Lia máy: khung hình chuyển thẳng sang lần thu phóng tiếp theo"},"emptyState": {"noVideo": "Chưa tải video",diff --git a/src/i18n/locales/zh-CN/timeline.json b/src/i18n/locales/zh-CN/timeline.jsonindex 32d1f8f60..f498c359a 100644--- a/src/i18n/locales/zh-CN/timeline.json+++ b/src/i18n/locales/zh-CN/timeline.json@@ -37,7 +37,8 @@"zoomIn": "放大过程:画面在缩放开始前逐渐放大","zoomOut": "缩小过程:画面在缩放结束后逐渐恢复","zoomInCut": "剪辑移除了放大过程的 {{seconds}} 秒。导出时画面会在剪切处跳变。",- "zoomOutCut": "剪辑移除了缩小过程的 {{seconds}} 秒。导出时画面会在剪切处跳变。"+ "zoomOutCut": "剪辑移除了缩小过程的 {{seconds}} 秒。导出时画面会在剪切处跳变。",+ "pan": "平移:画面直接移到下一个缩放"},"emptyState": {"noVideo": "未加载视频",diff --git a/src/i18n/locales/zh-TW/timeline.json b/src/i18n/locales/zh-TW/timeline.jsonindex 6f134cfde..34ace2112 100644--- a/src/i18n/locales/zh-TW/timeline.json+++ b/src/i18n/locales/zh-TW/timeline.json@@ -37,7 +37,8 @@"zoomIn": "放大過程:畫面在縮放開始前逐漸放大","zoomOut": "縮小過程:畫面在縮放結束後逐漸恢復","zoomInCut": "剪輯移除了放大過程的 {{seconds}} 秒。匯出時畫面會在剪切處跳動。",- "zoomOutCut": "剪輯移除了縮小過程的 {{seconds}} 秒。匯出時畫面會在剪切處跳動。"+ "zoomOutCut": "剪輯移除了縮小過程的 {{seconds}} 秒。匯出時畫面會在剪切處跳動。",+ "pan": "平移:畫面直接移到下一個縮放"},"emptyState": {"noVideo": "未載入影片",diff --git a/src/lib/ai-edition/timeline/zoom-transitions.test.ts b/src/lib/ai-edition/timeline/zoom-transitions.test.tsindex 2d7bab314..8d05e8e97 100644--- a/src/lib/ai-edition/timeline/zoom-transitions.test.ts+++ b/src/lib/ai-edition/timeline/zoom-transitions.test.ts@@ -1,7 +1,7 @@import { describe, expect, it } from "vitest";import { zoomTransitionMs } from "../../zoomMath/constants";import { type SpeedRegion, screenTimeMs, timelineTimeMs } from "./speed";-import { transitionCutsMs, zoomTransitions } from "./zoom-transitions";+import { chainedPans, transitionCutsMs, zoomTransitions } from "./zoom-transitions";const W = zoomTransitionMs(1.8); // ≈ 923 msconst zoom = { startMs: 10_000, endMs: 12_000, scale: 1.8 };@@ -65,3 +65,34 @@ describe("transitionCutsMs", () => {expect(transitionCutsMs(zoom, t, [{ startMs: 9000, endMs: 14_000 }])).toEqual(none);});});++describe("chainedPans", () => {+ const next = { startMs: 13_000, endMs: 15_000 };++ it("pans for 1 s from the first zoom's end when the next starts within 1.5 s", () => {+ expect(chainedPans([next, zoom], [], [])).toEqual([{ from: 1, to: 0, untilMs: 13_000 }]);+ expect(chainedPans([zoom, { startMs: 13_600, endMs: 15_000 }], [], [])).toEqual([]);+ });++ it("measures the gap and the pan on screen time", () => {+ const fast = [{ id: "s", startMs: 12_000, endMs: 20_000, speed: 3 }];+ // 3 s of timeline at 3× is 1 s on screen: chained, and the pan covers 3 s of timeline.+ expect(chainedPans([zoom, { startMs: 15_000, endMs: 16_000 }], fast, [])).toEqual([+ { from: 0, to: 1, untilMs: 15_000 },+ ]);+ });++ it("is broken by a trim or a clip junction between the zooms, not by one inside them", () => {+ expect(chainedPans([zoom, next], [], [{ startMs: 12_200, endMs: 12_400 }])).toEqual([]);+ expect(chainedPans([zoom, next], [], [{ startMs: 12_000, endMs: 12_000 }])).toEqual([]);+ expect(chainedPans([zoom, next], [], [{ startMs: 13_000, endMs: 13_000 }])).toEqual([]);+ expect(chainedPans([zoom, next], [], [{ startMs: 10_500, endMs: 11_000 }])).toHaveLength(1);+ });++ it("skips a zoom entirely under a trim, which the compositor never chains", () => {+ const hidden = { startMs: 11_000, endMs: 11_500 };+ expect(chainedPans([zoom, hidden, next], [], [hidden])).toEqual([+ { from: 0, to: 2, untilMs: 13_000 },+ ]);+ });+});diff --git a/src/lib/ai-edition/timeline/zoom-transitions.ts b/src/lib/ai-edition/timeline/zoom-transitions.tsindex 6d0440ea4..95d03520b 100644--- a/src/lib/ai-edition/timeline/zoom-transitions.ts+++ b/src/lib/ai-edition/timeline/zoom-transitions.ts@@ -6,11 +6,15 @@// off them: the render drops the trimmed frames, so the camera jumps at the cut instead of// easing.//-// Chained zooms (closer than 1.5 s, panned between) are measured as if apart. That is the-// right answer for trims: a trim between two zooms splits them into separate segments, which-// breaks the chain, and each then needs its own windows untrimmed.+// 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.-import { zoomTransitionMs } from "../../zoomMath/constants";+import {+ CHAINED_ZOOM_PAN_GAP_MS,+ CONNECTED_ZOOM_PAN_DURATION_MS,+ zoomTransitionMs,+} from "../../zoomMath/constants";import { type SpeedRegion, screenTimeMs, timelineTimeMs } from "./speed";import { ZOOM_DEPTH_SCALES } from "./zoom-scale";@@ -75,3 +79,46 @@ export function transitionCutsMs(}return { inMs: resumesAt - transitions.inFromMs, outMs: transitions.outUntilMs - jumpsAt };}++export interface ChainedPan {+ /** Index of the zoom the pan leaves from its end: it has no zoom-out. */+ from: number;+ /** Index of the zoom the pan reaches: it has no zoom-in. */+ to: number;+ /** Timeline ms where the pan is over. It can run into the next zoom's span. */+ untilMs: number;+}++/**+ * The pans between chained zooms (mirror of `connected_pairs`, regions.rs): two consecutive+ * zooms at most 1.5 s apart on screen, panned between over 1 s of SCREEN time from the first+ * one's end. The compositor renders each clip segment on its own, so a cut between them+ * (a trim, or a clip junction as a zero-length span) breaks the chain, and a zoom entirely+ * under a trim takes no part in one.+ */+export function chainedPans(+ zooms: readonly Span[],+ speedRegions: readonly SpeedRegion[],+ cuts: readonly Span[],+): ChainedPan[] {+ const order = zooms+ .map((_, i) => i)+ .filter((i) => !cuts.some((c) => c.startMs <= zooms[i].startMs && c.endMs >= zooms[i].endMs))+ .sort((a, b) => zooms[a].startMs - zooms[b].startMs);+ return order.slice(1).flatMap((to, k) => {+ const from = order[k];+ const panFrom = screenTimeMs(speedRegions, zooms[from].endMs);+ const chained =+ screenTimeMs(speedRegions, zooms[to].startMs) - panFrom <= CHAINED_ZOOM_PAN_GAP_MS &&+ !cuts.some((c) => c.startMs <= zooms[to].startMs && c.endMs >= zooms[from].endMs);+ return chained+ ? [+ {+ from,+ to,+ untilMs: timelineTimeMs(speedRegions, panFrom + CONNECTED_ZOOM_PAN_DURATION_MS),+ },+ ]+ : [];+ });+}diff --git a/src/lib/zoomMath/constants.ts b/src/lib/zoomMath/constants.tsindex 1be35b4af..3d27687a2 100644--- a/src/lib/zoomMath/constants.ts+++ b/src/lib/zoomMath/constants.ts@@ -10,6 +10,11 @@ export const ZOOM_TRANSITION_PER_LN_MS = 550;export function zoomTransitionMs(scale: number): number {return ZOOM_TRANSITION_BASE_MS + ZOOM_TRANSITION_PER_LN_MS * Math.log(Math.max(1, scale));}+// Two zooms at most this far apart on screen are chained: no zoom-out and back in, the camera+// pans from one to the other over CONNECTED_ZOOM_PAN_DURATION_MS of screen time from the first+// one's end. Mirror of `CHAINED_ZOOM_PAN_GAP_S` / `CONNECTED_ZOOM_PAN_DURATION_S` (regions.rs).+export const CHAINED_ZOOM_PAN_GAP_MS = 1500;+export const CONNECTED_ZOOM_PAN_DURATION_MS = 1000;export const SMOOTHING_FACTOR = 0.12;export const ZOOM_TRANSLATION_DEADZONE_PX = 1.25;export const ZOOM_SCALE_DEADZONE = 0.002;diff --git a/src/lib/zoomMath/zoomRegionUtils.ts b/src/lib/zoomMath/zoomRegionUtils.tsindex 79de91088..df0f0deb3 100644--- a/src/lib/zoomMath/zoomRegionUtils.ts+++ b/src/lib/zoomMath/zoomRegionUtils.ts@@ -12,14 +12,15 @@ import {} from "@/components/video-editor/types";import { type SpeedRegion, screenTimeMs } from "@/lib/ai-edition/timeline/speed";import { clamp01 } from "@/utils/math";-import { zoomTransitionMs } from "./constants";+import {+ CHAINED_ZOOM_PAN_GAP_MS,+ CONNECTED_ZOOM_PAN_DURATION_MS,+ zoomTransitionMs,+} from "./constants";import { interpolateCursorAt } from "./cursorFollowUtils";import { clampFocusToScale } from "./focusUtils";import { cubicBezier, easeSpring, scaleLerp } from "./mathUtils";-const CHAINED_ZOOM_PAN_GAP_MS = 1500;-const CONNECTED_ZOOM_PAN_DURATION_MS = 1000;-/** Timeline ms → screen ms. Transition windows are measured on it, see `screenTimeMs`. */type ScreenClock = (timeMs: number) => number;diff --git a/technical-documentation/architecture/ai-agent.md b/technical-documentation/architecture/ai-agent.mdindex e43e446b1..e6b9992e5 100644--- a/technical-documentation/architecture/ai-agent.md+++ b/technical-documentation/architecture/ai-agent.md@@ -45,7 +45,7 @@ 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). | 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`, 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. || `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`. |