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): add a Clear zooms button
EtienneLescotb64044518ad8
diff --git a/src/components/ai-edition/v4/V4Timeline.geometry.test.tsx b/src/components/ai-edition/v4/V4Timeline.geometry.test.tsxindex 6595abd52..3589029a5 100644--- a/src/components/ai-edition/v4/V4Timeline.geometry.test.tsx+++ b/src/components/ai-edition/v4/V4Timeline.geometry.test.tsx@@ -92,6 +92,7 @@ function renderTimeline(annotation = { id: "ann1", startMs: 10_000, endMs: 11_000 },assets: Array<Record<string, unknown>> = [NO_CAMERA_ASSET],onRender?: ProfilerOnRenderCallback,+ zoomRegions: Array<Record<string, unknown>> = [],) {const tl = {clips,@@ -102,7 +103,7 @@ function renderTimeline(annotationRegions: [annotation],speedRegions: [],cameraFullscreenRegions: [],- zoomRegions: [],+ zoomRegions,trimRanges: [],selection: null,multiSelection: [],@@ -119,6 +120,9 @@ function renderTimeline(addZoom: vi.fn(async () => {/* the toolbar only awaits it */}),+ clearZooms: vi.fn(async () => {+ /* the toolbar only awaits it */+ }),};const setCurrentTime = vi.fn();const timeline = (@@ -403,6 +407,21 @@ describe("V4Timeline create-from-toolbar", () => {expect(durationOf(tl)).toBeCloseTo(0.25, 3);});+ // Clear zooms (#723) exists only while there is something to clear: absent, never greyed out.+ it("shows no Clear zooms button while the project has no zoom", () => {+ renderTimeline();+ expect(screen.queryByLabelText("buttons.clearZooms")).not.toBeInTheDocument();+ });++ it("shows Clear zooms once a zoom exists, and one click asks the store to clear them all", () => {+ const { tl } = renderTimeline(undefined, undefined, undefined, undefined, [+ { id: "z1", startMs: 1000, endMs: 3000, depth: 3 },+ { id: "z2", startMs: 9000, endMs: 11_000, depth: 3 },+ ]);+ fireEvent.click(screen.getByLabelText("buttons.clearZooms"));+ expect(tl.clearZooms).toHaveBeenCalledTimes(1);+ });+// #353. A camera-fullscreen region grows the webcam overlay, so with no webcam on the// timeline it renders nothing in the preview and nothing in the export — the region is// stored and forgotten. `addCameraFullscreen` now refuses to write one; the button saysdiff --git a/src/components/ai-edition/v4/V4Timeline.tsx b/src/components/ai-edition/v4/V4Timeline.tsxindex 634effef8..b02a366cd 100644--- a/src/components/ai-edition/v4/V4Timeline.tsx+++ b/src/components/ai-edition/v4/V4Timeline.tsx@@ -1986,6 +1986,20 @@ export function V4Timeline({<Crosshair size={16} /></button></Tooltip>+ {/* Absent, not greyed out, when there is nothing to clear. One write in the+ store, so one Ctrl+Z restores every zoom. */}+ {tl.zoomRegions.length > 0 ? (+ <Tooltip content={t("buttons.clearZooms")}>+ <button+ type="button"+ className={styles.tlToolBtn}+ aria-label={t("buttons.clearZooms")}+ onClick={() => void tl.clearZooms()}+ >+ <Trash2 size={16} />+ </button>+ </Tooltip>+ ) : null}<Tooltip content={t("buttons.addCameraFullscreen")}><buttontype="button"diff --git a/src/i18n/locales/ar/timeline.json b/src/i18n/locales/ar/timeline.jsonindex c3c5df4e9..391d5f602 100644--- a/src/i18n/locales/ar/timeline.json+++ b/src/i18n/locales/ar/timeline.json@@ -6,6 +6,7 @@"autoZoomOff": "اقتراحات التكبير التلقائي معطّلة — انقر لاقتراح تكبيرات من المؤشر","autoFocusAllOn": "التركيز التلقائي مفعّل لجميع التكبيرات — انقر للتبديل إلى يدوي للجميع","autoFocusAllOff": "تفعيل التركيز التلقائي لجميع التكبيرات (الكاميرا تتبع المؤشر)",+ "clearZooms": "مسح التكبيرات","addTrim": "إضافة قص (T)","addAnnotation": "إضافة شرح (A)","addSpeed": "إضافة سرعة (S)",diff --git a/src/i18n/locales/cs/timeline.json b/src/i18n/locales/cs/timeline.jsonindex 033a978be..ec4869b27 100644--- a/src/i18n/locales/cs/timeline.json+++ b/src/i18n/locales/cs/timeline.json@@ -6,6 +6,7 @@"autoZoomOff": "Automatické návrhy přiblížení vypnuty, klikněte pro návrh přiblížení podle kurzoru","autoFocusAllOn": "Automatické zaostření zapnuto pro všechna přiblížení, klikněte pro přepnutí všech na ruční","autoFocusAllOff": "Automaticky zaostřit všechna přiblížení (kamera sleduje kurzor)",+ "clearZooms": "Vymazat přiblížení","addTrim": "Přidat oříznutí (T)","addAnnotation": "Přidat anotaci (A)","addSpeed": "Přidat rychlost (S)",diff --git a/src/i18n/locales/de/timeline.json b/src/i18n/locales/de/timeline.jsonindex 28b5ef036..b13cec5b7 100644--- a/src/i18n/locales/de/timeline.json+++ b/src/i18n/locales/de/timeline.json@@ -6,6 +6,7 @@"autoZoomOff": "Zoom-Vorschläge aus — klicken, um Zooms aus der Cursorbewegung vorzuschlagen","autoFocusAllOn": "Auto-Fokus für alle Zooms an — klicken, um alle auf manuell umzustellen","autoFocusAllOff": "Auto-Fokus für alle Zooms (Kamera folgt dem Cursor)",+ "clearZooms": "Zooms löschen","addTrim": "Trim hinzufügen (T)","addAnnotation": "Anmerkung hinzufügen (A)","addSpeed": "Tempo hinzufügen (S)",diff --git a/src/i18n/locales/en/timeline.json b/src/i18n/locales/en/timeline.jsonindex 5a0267fb2..76cce42f4 100644--- a/src/i18n/locales/en/timeline.json+++ b/src/i18n/locales/en/timeline.json@@ -6,6 +6,7 @@"autoZoomOff": "Auto zoom suggestions off — click to suggest zooms from cursor","autoFocusAllOn": "Auto-Focus on for all zooms — click to switch all to manual","autoFocusAllOff": "Auto-Focus all zooms (camera follows the cursor)",+ "clearZooms": "Clear zooms","addTrim": "Add trim (T)","addAnnotation": "Add annotation (A)","addSpeed": "Add speed (S)",diff --git a/src/i18n/locales/es/timeline.json b/src/i18n/locales/es/timeline.jsonindex 355eb3a76..7ed5d92e1 100644--- a/src/i18n/locales/es/timeline.json+++ b/src/i18n/locales/es/timeline.json@@ -6,6 +6,7 @@"autoZoomOff": "Sugerencias de zoom automático desactivadas — haz clic para sugerir zooms desde el cursor","autoFocusAllOn": "Enfoque automático activado para todos los zooms — haz clic para pasar todos a manual","autoFocusAllOff": "Activar enfoque automático para todos los zooms (la cámara sigue el cursor)",+ "clearZooms": "Borrar zooms","addTrim": "Agregar recorte (T)","addAnnotation": "Agregar anotación (A)","addSpeed": "Agregar velocidad (S)",diff --git a/src/i18n/locales/fr/timeline.json b/src/i18n/locales/fr/timeline.jsonindex b74ccb471..9fdf817a1 100644--- a/src/i18n/locales/fr/timeline.json+++ b/src/i18n/locales/fr/timeline.json@@ -6,6 +6,7 @@"autoZoomOff": "Suggestions de zoom automatique désactivées — cliquez pour suggérer des zooms depuis le curseur","autoFocusAllOn": "Mise au point automatique activée pour tous les zooms — cliquez pour tout passer en manuel","autoFocusAllOff": "Activer la mise au point automatique pour tous les zooms (la caméra suit le curseur)",+ "clearZooms": "Effacer les zooms","addTrim": "Ajouter une coupe (T)","addAnnotation": "Ajouter une annotation (A)","addSpeed": "Ajouter une vitesse (S)",diff --git a/src/i18n/locales/it/timeline.json b/src/i18n/locales/it/timeline.jsonindex b2fc550e9..c98f4038c 100644--- a/src/i18n/locales/it/timeline.json+++ b/src/i18n/locales/it/timeline.json@@ -6,6 +6,7 @@"autoZoomOff": "Suggerimenti di zoom automatico disattivi — clicca per suggerire zoom dal cursore","autoFocusAllOn": "Messa a fuoco automatica attiva per tutti gli zoom — clicca per passare tutti a manuale","autoFocusAllOff": "Attiva la messa a fuoco automatica per tutti gli zoom (la fotocamera segue il cursore)",+ "clearZooms": "Cancella zoom","addTrim": "Aggiungi taglio (T)","addAnnotation": "Aggiungi annotazione (A)","addSpeed": "Aggiungi velocità (S)",diff --git a/src/i18n/locales/ja-JP/timeline.json b/src/i18n/locales/ja-JP/timeline.jsonindex 7d1647935..a7debcfbe 100644--- a/src/i18n/locales/ja-JP/timeline.json+++ b/src/i18n/locales/ja-JP/timeline.json@@ -6,6 +6,7 @@"autoZoomOff": "自動ズーム提案がオフ — クリックするとカーソル位置からズームを提案します","autoFocusAllOn": "すべてのズームでオートフォーカスがオン — クリックするとすべて手動に切り替わります","autoFocusAllOff": "すべてのズームでオートフォーカスをオンにする(カメラがカーソルに追従)",+ "clearZooms": "ズームをクリア","addTrim": "トリムを追加 (T)","addAnnotation": "注釈を追加 (A)","addSpeed": "再生速度を追加 (S)",diff --git a/src/i18n/locales/ko-KR/timeline.json b/src/i18n/locales/ko-KR/timeline.jsonindex 9052eb096..a601f888e 100644--- a/src/i18n/locales/ko-KR/timeline.json+++ b/src/i18n/locales/ko-KR/timeline.json@@ -6,6 +6,7 @@"autoZoomOff": "자동 줌 제안 꺼짐 — 클릭하면 커서 기반으로 줌을 제안합니다","autoFocusAllOn": "모든 줌에 자동 초점 켜짐 — 클릭하면 모두 수동으로 전환합니다","autoFocusAllOff": "모든 줌에 자동 초점 켜기 (카메라가 커서를 따라갑니다)",+ "clearZooms": "줌 지우기","addTrim": "트림 추가 (T)","addAnnotation": "주석 추가 (A)","addSpeed": "속도 추가 (S)",diff --git a/src/i18n/locales/pt-BR/timeline.json b/src/i18n/locales/pt-BR/timeline.jsonindex 0165dc7db..739bf30d4 100644--- a/src/i18n/locales/pt-BR/timeline.json+++ b/src/i18n/locales/pt-BR/timeline.json@@ -6,6 +6,7 @@"autoZoomOff": "Sugestões de zoom automático desativadas — clique para sugerir zooms a partir do cursor","autoFocusAllOn": "Foco automático ativado para todos os zooms — clique para mudar todos para manual","autoFocusAllOff": "Ativar foco automático para todos os zooms (a câmera segue o cursor)",+ "clearZooms": "Limpar zooms","addTrim": "Adicionar Recorte (T)","addAnnotation": "Adicionar Anotação (A)","addSpeed": "Adicionar Velocidade (S)",diff --git a/src/i18n/locales/ru/timeline.json b/src/i18n/locales/ru/timeline.jsonindex cd19dc201..404fad1c1 100644--- a/src/i18n/locales/ru/timeline.json+++ b/src/i18n/locales/ru/timeline.json@@ -6,6 +6,7 @@"autoZoomOff": "Автоматические предложения масштабирования выключены — нажмите, чтобы предложить зумы по курсору","autoFocusAllOn": "Автофокус включён для всех зумов — нажмите, чтобы переключить все в ручной режим","autoFocusAllOff": "Включить автофокус для всех зумов (камера следует за курсором)",+ "clearZooms": "Очистить зумы","addTrim": "Добавить обрезку (T)","addAnnotation": "Добавить аннотацию (A)","addSpeed": "Изменить скорость (S)",diff --git a/src/i18n/locales/tr/timeline.json b/src/i18n/locales/tr/timeline.jsonindex 39807b729..dfdfc1229 100644--- a/src/i18n/locales/tr/timeline.json+++ b/src/i18n/locales/tr/timeline.json@@ -6,6 +6,7 @@"autoZoomOff": "Otomatik yakınlaştırma önerileri kapalı — imleçten yakınlaştırma önermek için tıklayın","autoFocusAllOn": "Tüm yakınlaştırmalarda Otomatik Odak açık — hepsini manuel yapmak için tıklayın","autoFocusAllOff": "Tüm yakınlaştırmalarda Otomatik Odağı aç (kamera imleci takip eder)",+ "clearZooms": "Yakınlaştırmaları Temizle","addTrim": "Kırpma Ekle (T)","addAnnotation": "Açıklama Ekle (A)","addSpeed": "Hız Ekle (S)",diff --git a/src/i18n/locales/vi/timeline.json b/src/i18n/locales/vi/timeline.jsonindex b4abac5e2..eeb85ea5d 100644--- a/src/i18n/locales/vi/timeline.json+++ b/src/i18n/locales/vi/timeline.json@@ -6,6 +6,7 @@"autoZoomOff": "Đề xuất thu phóng tự động đang tắt — nhấp để đề xuất thu phóng từ con trỏ","autoFocusAllOn": "Lấy nét tự động đang bật cho tất cả các thu phóng — nhấp để chuyển tất cả sang thủ công","autoFocusAllOff": "Bật lấy nét tự động cho tất cả các thu phóng (máy ảnh theo dõi con trỏ)",+ "clearZooms": "Xóa thu phóng","addTrim": "Thêm Cắt (T)","addAnnotation": "Thêm Chú thích (A)","addSpeed": "Thêm Tốc độ (S)",diff --git a/src/i18n/locales/zh-CN/timeline.json b/src/i18n/locales/zh-CN/timeline.jsonindex 63b0e0c41..4bb4a8ac1 100644--- a/src/i18n/locales/zh-CN/timeline.json+++ b/src/i18n/locales/zh-CN/timeline.json@@ -6,6 +6,7 @@"autoZoomOff": "自动缩放建议已关闭 — 点击可根据光标建议缩放","autoFocusAllOn": "所有缩放的自动对焦已开启 — 点击可将全部切换为手动","autoFocusAllOff": "为所有缩放开启自动对焦(摄像头跟随光标)",+ "clearZooms": "清除缩放","addTrim": "添加剪辑 (T)","addAnnotation": "添加标注 (A)","addSpeed": "添加速度 (S)",diff --git a/src/i18n/locales/zh-TW/timeline.json b/src/i18n/locales/zh-TW/timeline.jsonindex de6dc2845..16eae1ee9 100644--- a/src/i18n/locales/zh-TW/timeline.json+++ b/src/i18n/locales/zh-TW/timeline.json@@ -6,6 +6,7 @@"autoZoomOff": "自動縮放建議已關閉 — 點擊可根據游標建議縮放","autoFocusAllOn": "所有縮放的自動對焦已開啟 — 點擊可將全部切換為手動","autoFocusAllOff": "為所有縮放開啟自動對焦(攝影機跟隨游標)",+ "clearZooms": "清除縮放","addTrim": "新增剪輯 (T)","addAnnotation": "新增標註 (A)","addSpeed": "新增速度 (S)",diff --git a/src/lib/ai-edition/store/documentWriteAudit.test.ts b/src/lib/ai-edition/store/documentWriteAudit.test.tsindex 263c1ab6a..c0f3ac84b 100644--- a/src/lib/ai-edition/store/documentWriteAudit.test.ts+++ b/src/lib/ai-edition/store/documentWriteAudit.test.ts@@ -254,6 +254,8 @@ const DECLARED: WritePath[] = [w("src/lib/ai-edition/store/useTimeline.ts", "addTrim", "save", "gesture"),w("src/lib/ai-edition/store/useTimeline.ts", "addZoom", "save", "gesture"),w("src/lib/ai-edition/store/useTimeline.ts", "addZoomsBulk", "save", "gesture"),+ // The Clear zooms button: every zoom in one write, so one undo step.+ w("src/lib/ai-edition/store/useTimeline.ts", "clearZooms", "save", "gesture"),// The two drag commits. One undo step per gesture, recorded on release and only// if the write lands — `historyBase` carries the pre-drag document.w("src/lib/ai-edition/store/useTimeline.ts", "commitAnnotationChange", "save", "gesture"),diff --git a/src/lib/ai-edition/store/useTimeline.test.ts b/src/lib/ai-edition/store/useTimeline.test.tsindex b72b924cb..74e5de7b8 100644--- a/src/lib/ai-edition/store/useTimeline.test.ts+++ b/src/lib/ai-edition/store/useTimeline.test.ts@@ -734,6 +734,134 @@ describe("useTimeline.addAnnotation", () => {});});+// The Clear zooms button. Zooms only, every clip, one write.+describe("useTimeline.clearZooms", () => {+ const zoom = (+ id: string,+ clipId: string,+ timelineSec: number,+ sourceSec: number,+ ): AxcutDocument["zoomRanges"][number] => ({+ id,+ startMs: timelineSec * 1000,+ endMs: (timelineSec + 2) * 1000,+ depth: 3,+ focus: { cx: 0.5, cy: 0.5 },+ focusMode: "manual",+ clipId,+ sourceStartSec: sourceSec,+ sourceEndSec: sourceSec + 2,+ });+ const twoClipsTwoZooms: AxcutDocument = {+ ...sampleDoc,+ timeline: {+ ...sampleDoc.timeline,+ clips: [+ ...sampleDoc.timeline.clips,+ {+ ...sampleDoc.timeline.clips[0],+ id: "clip_b",+ timelineStartSec: 10,+ timelineEndSec: 20,+ },+ ],+ },+ zoomRanges: [zoom("zoom_a", "clip_a", 1, 1), zoom("zoom_b", "clip_b", 12, 2)],+ };++ beforeEach(() => {+ useProjectStore.getState().clear();+ for (const mock of Object.values(bridgeMocks)) mock.mockReset();+ bridgeMocks.save.mockImplementation(async (doc: typeof sampleDoc) => ({+ success: true,+ document: doc,+ }));+ useProjectStore.setState({+ projectId: "proj_test",+ document: twoClipsTwoZooms,+ currentTimeSec: 1,+ revision: 1,+ status: "ready",+ error: null,+ });+ });++ afterEach(() => {+ vi.clearAllMocks();+ });++ it("removes the zooms of every clip and nothing else", async () => {+ const { result } = renderTimeline();+ await act(async () => {+ await result.current.addAnnotation();+ });+ await act(async () => {+ await result.current.clearZooms();+ });+ const doc = useProjectStore.getState().document;+ expect(doc?.zoomRanges).toEqual([]);+ expect(doc?.annotations).toHaveLength(1);+ expect(doc?.timeline.clips).toHaveLength(2);+ });++ it("is one undo step: a single Ctrl+Z restores every zoom, redo clears them again", async () => {+ const { result } = renderTimeline();+ await act(async () => {+ await result.current.clearZooms();+ });+ expect(past).toHaveLength(1);++ act(() => {+ expect(undo()).toBe(true);+ });+ expect(useProjectStore.getState().document?.zoomRanges.map((z) => z.id)).toEqual([+ "zoom_a",+ "zoom_b",+ ]);++ act(() => {+ expect(redo()).toBe(true);+ });+ expect(useProjectStore.getState().document?.zoomRanges).toEqual([]);+ });++ it("lets go of a selected zoom, which no longer exists", async () => {+ const { result } = renderTimeline();+ act(() => result.current.selectRegion("zoom", "zoom_a"));+ expect(result.current.selection).toEqual({ kind: "zoom", id: "zoom_a" });++ await act(async () => {+ await result.current.clearZooms();+ });+ expect(result.current.selection).toBeNull();+ expect(result.current.multiSelection).toEqual([]);+ });++ it("keeps an annotation selected", async () => {+ const { result } = renderTimeline();+ await act(async () => {+ await result.current.addAnnotation();+ });+ const selected = result.current.selection;+ expect(selected?.kind).toBe("annotation");++ await act(async () => {+ await result.current.clearZooms();+ });+ expect(result.current.selection).toEqual(selected);+ });++ it("writes nothing when there is no zoom", async () => {+ useProjectStore.setState({ document: { ...twoClipsTwoZooms, zoomRanges: [] } });+ const { result } = renderTimeline();+ await act(async () => {+ await result.current.clearZooms();+ });+ expect(bridgeMocks.save).not.toHaveBeenCalled();+ expect(past).toHaveLength(0);+ });+});+describe("useTimeline zoom modifiers (rotation + focus mode)", () => {const docWithZoom: AxcutDocument = {...sampleDoc,diff --git a/src/lib/ai-edition/store/useTimeline.ts b/src/lib/ai-edition/store/useTimeline.tsindex 3f7c1e457..8c41cc59f 100644--- a/src/lib/ai-edition/store/useTimeline.ts+++ b/src/lib/ai-edition/store/useTimeline.ts@@ -1135,6 +1135,15 @@ export function useTimeline() {[document, saveDocument],);+ // Every zoom region, across all clips, in one write: one undo step brings them all+ // back. Zooms only — trims, speeds, annotations and camera segments are untouched.+ const clearZooms = useCallback(async () => {+ if (!document || document.zoomRanges.length === 0) return;+ if (!(await saveDocument({ ...document, zoomRanges: [] }, { history: true }))) return;+ if (selection?.kind === "zoom") setSelection(null);+ setMultiSelection((prev) => prev.filter((h) => h.kind !== "zoom"));+ }, [document, selection, saveDocument]);+// Selecting a pill and selecting a clip are the SAME act — "this is the thing// I mean" — so they cancel each other. They used to be two states that could// both be set: the user saw one highlighted element while the app still held@@ -1634,6 +1643,7 @@ export function useTimeline() {addCameraFullscreen,removeRegion,removeRegions,+ clearZooms,addAudioTrack,addAudio,removeAudioTrack,diff --git a/technical-documentation/testing/manual-e2e-checklist.md b/technical-documentation/testing/manual-e2e-checklist.mdindex 7404054d9..ded9493d7 100644--- a/technical-documentation/testing/manual-e2e-checklist.md+++ b/technical-documentation/testing/manual-e2e-checklist.md@@ -295,6 +295,7 @@ The timeline toolbar adds each kind: *Add zoom (Z)*, *Add trim (T)*, *Add speed- [ ] Set a zoom region's *Focus mode* to Auto and confirm its focus follows cursor telemetry across the whole region.- [ ] Use *Auto-enhance* → *Automatic zooms* and confirm it adds suggested zoom regions when cursor telemetry supports suggestions, or says why not ("No room for automatic zooms" on a take whose zooms were already placed after recording).- [ ] Select a zoom region and activate *Delete zoom* in the inspector; confirm it disappears from the lane.+- [ ] With two or more zooms on the timeline, activate *Clear zooms* (the trash button after *Auto-Focus all zooms*, absent while no zoom exists) and confirm every zoom disappears in one step and one `Ctrl+Z` brings them all back.- [ ] Activate *Add speed (S)* and confirm a speed region appears.- [ ] Pick each speed in the *Playback speed* row (0.5×, 1×, 1.5×, 2×, 4×) and confirm the lane label and preview timing change.- [ ] Enter a custom speed in the *Custom speed* field, commit it, and confirm the value is kept, with no preset pressed.