Create polished demo videos without editing skills. Mac/Windows/Linux
fix: address review issues and preserve editor rollback
webadderallf65e0090dc13
diff --git a/src/components/video-editor/VideoEditor.tsx b/src/components/video-editor/VideoEditor.tsxindex 48214b92..0ddbae82 100644--- a/src/components/video-editor/VideoEditor.tsx+++ b/src/components/video-editor/VideoEditor.tsx@@ -2823,25 +2823,30 @@ export default function VideoEditor() {if (totalMs <= 0) return;if (!clipInitializedRef.current) {if (clipRegions.length === 0) {+ const nextClipRegions =+ trimRegions.length > 0+ ? trimsToClips(trimRegions, totalMs)+ : (() => {+ const id = `clip-${nextClipIdRef.current++}`;+ autoFullTrackClipIdRef.current = id;+ autoFullTrackClipEndMsRef.current = totalMs;+ return [{ id, startMs: 0, endMs: totalMs, speed: 1 }];+ })();+if (trimRegions.length > 0) {- setClipRegions(trimsToClips(trimRegions, totalMs));- clipInitializedRef.current = true;- return;- }- const id = `clip-${nextClipIdRef.current++}`;- autoFullTrackClipIdRef.current = id;- autoFullTrackClipEndMsRef.current = totalMs;- if (trimRegions.length > 0) {- const derivedClipRegions = trimsToClips(trimRegions, totalMs);nextClipIdRef.current = deriveNextId("clip",- derivedClipRegions.map((region) => region.id),+ nextClipRegions.map((region) => region.id),);- setClipRegions(derivedClipRegions);- clipInitializedRef.current = true;- return;}- setClipRegions([{ id, startMs: 0, endMs: totalMs, speed: 1 }]);++ setClipRegions(nextClipRegions);+ if (speedRegions.length > 0) {+ // Legacy speed regions no longer have dedicated editing surfaces.+ // Clear them during clip bootstrap so old projects do not keep+ // hidden playback changes that users cannot inspect or edit.+ setSpeedRegions([]);+ }}clipInitializedRef.current = true;return;@@ -2857,7 +2862,7 @@ export default function VideoEditor() {autoFullTrackClipEndMsRef.current = totalMs;setClipRegions(extendedClipRegions);- }, [duration, clipRegions, trimRegions]);+ }, [duration, clipRegions, trimRegions, speedRegions]);// Derive trimRegions from clipRegions so export/playback pipelines stay unchangeduseEffect(() => {diff --git a/src/components/video-editor/VideoPlayback.tsx b/src/components/video-editor/VideoPlayback.tsxindex 0721442a..11002c6a 100644--- a/src/components/video-editor/VideoPlayback.tsx+++ b/src/components/video-editor/VideoPlayback.tsx@@ -1102,7 +1102,7 @@ const VideoPlayback = forwardRef<VideoPlaybackRef, VideoPlaybackProps>(return;}- videoEffectsContainer.filters = [zoomBlurFilter, motionBlurFilter];+ videoEffectsContainer.filters = null;motionBlurFilter.velocity = { x: 0, y: 0 };motionBlurFilter.kernelSize = 5;motionBlurFilter.offset = 0;@@ -1443,10 +1443,6 @@ const VideoPlayback = forwardRef<VideoPlaybackRef, VideoPlaybackProps>(videoEffectsContainerRef.current = videoEffectsContainer;zoomBlurFilterRef.current = new ZoomBlurFilter({ strength: 0 });motionBlurFilterRef.current = new MotionBlurFilter([0, 0], 5, 0);- videoEffectsContainer.filters = [- zoomBlurFilterRef.current,- motionBlurFilterRef.current,- ];cameraContainer.addChild(videoEffectsContainer);syncPreviewMotionBlurQuality();diff --git a/src/components/video-editor/videoPlayback/cursorFollowCamera.test.ts b/src/components/video-editor/videoPlayback/cursorFollowCamera.test.tsindex ecde93ad..8493623a 100644--- a/src/components/video-editor/videoPlayback/cursorFollowCamera.test.ts+++ b/src/components/video-editor/videoPlayback/cursorFollowCamera.test.ts@@ -72,9 +72,9 @@ describe("computeCursorFollowFocus", () => {{ snapToEdgesRatio: 0.25 },);- expect(firstShift.cx).toBeCloseTo(0.575, 6);+ expect(firstShift.cx).toBeCloseTo(0.7, 6);expect(firstShift.cy).toBeCloseTo(0.5, 6);- expect(secondShift.cx).toBeCloseTo(0.595, 6);+ expect(secondShift.cx).toBeCloseTo(0.7, 6);expect(secondShift.cy).toBeCloseTo(0.5, 6);});@@ -107,45 +107,4 @@ describe("computeCursorFollowFocus", () => {expect(clampedFocus).toEqual({ cx: 0.75, cy: 0.75 });});-- it("reinitializes focus when time goes backward during zoom-out", () => {- const state = createCursorFollowCameraState();- const cursorSamples = [- { timeMs: 0, cx: 0.5, cy: 0.5, interactionType: "move" as const },- { timeMs: 100, cx: 0.8, cy: 0.5, interactionType: "move" as const },- ];-- computeCursorFollowFocus(- state,- cursorSamples,- 100,- 2,- 1,- { cx: 0.5, cy: 0.5 },- { snapToEdgesRatio: 0.25 },- );-- const frozenFocus = computeCursorFollowFocus(- state,- cursorSamples,- 140,- 2,- 0.8,- { cx: 0.5, cy: 0.5 },- { snapToEdgesRatio: 0.25 },- );-- const rewoundFocus = computeCursorFollowFocus(- state,- cursorSamples,- 0,- 2,- 0.8,- { cx: 0.5, cy: 0.5 },- { snapToEdgesRatio: 0.25 },- );-- expect(frozenFocus.cx).toBeCloseTo(0.675, 6);- expect(rewoundFocus).toEqual({ cx: 0.5, cy: 0.5 });- });});\ No newline at end of filediff --git a/src/components/video-editor/videoPlayback/cursorFollowCamera.ts b/src/components/video-editor/videoPlayback/cursorFollowCamera.tsindex ced118a8..75106a81 100644--- a/src/components/video-editor/videoPlayback/cursorFollowCamera.ts+++ b/src/components/video-editor/videoPlayback/cursorFollowCamera.ts@@ -100,15 +100,15 @@ function recenterFocusWhenCursorLeavesSafeZone(let nextFocusY = currentFocus.cy;if (cursorFocus.cx < safeLeft) {- nextFocusX = cursorFocus.cx + halfSpan - safeZoneInset;+ nextFocusX = cursorFocus.cx;} else if (cursorFocus.cx > safeRight) {- nextFocusX = cursorFocus.cx - halfSpan + safeZoneInset;+ nextFocusX = cursorFocus.cx;}if (cursorFocus.cy < safeTop) {- nextFocusY = cursorFocus.cy + halfSpan - safeZoneInset;+ nextFocusY = cursorFocus.cy;} else if (cursorFocus.cy > safeBottom) {- nextFocusY = cursorFocus.cy - halfSpan + safeZoneInset;+ nextFocusY = cursorFocus.cy;}return clampFocusToScale(@@ -157,21 +157,18 @@ export function computeCursorFollowFocus(: clampedRegionFocus;}- const timeWentBackwards = state.initialized && timeMs + 0.5 < state.lastTimeMs;- if (timeWentBackwards) {- state.reachedFullZoom = false;- }-// Track when zoom reaches full strengthif (zoomStrength >= 0.99) {state.reachedFullZoom = true;}// Zooming out: was fully zoomed but strength is now dropping — freeze camera- if (!timeWentBackwards && state.reachedFullZoom && zoomStrength < 0.99) {+ if (state.reachedFullZoom && zoomStrength < 0.99) {return { cx: state.frozenFocusX, cy: state.frozenFocusY };}+ const timeWentBackwards = state.initialized && timeMs + 0.5 < state.lastTimeMs;+if (!state.initialized || !state.wasZoomed || timeWentBackwards) {const initialFocus = recenterFocusWhenCursorLeavesSafeZone(clampedRegionFocus,diff --git a/src/hooks/useScreenRecorder.ts b/src/hooks/useScreenRecorder.tsindex 7e2d41f7..5ecf6be2 100644--- a/src/hooks/useScreenRecorder.ts+++ b/src/hooks/useScreenRecorder.ts@@ -1435,13 +1435,14 @@ export function useScreenRecorder(): UseScreenRecorderReturn {if (webcamRecorder.current?.state === "recording") {webcamRecorder.current.pause();}+ const boundaryMs = Date.now();+ markRecordingPaused(boundaryMs);+ setPaused(true);try {await window.electronAPI.pauseCursorCapture();} catch (error) {console.warn("Failed to pause cursor capture:", error);}- markRecordingPaused(Date.now());- setPaused(true);})();return;}@@ -1451,13 +1452,14 @@ export function useScreenRecorder(): UseScreenRecorderReturn {webcamRecorder.current.pause();}void (async () => {+ const boundaryMs = Date.now();+ markRecordingPaused(boundaryMs);+ setPaused(true);try {await window.electronAPI.pauseCursorCapture();} catch (error) {console.warn("Failed to pause cursor capture:", error);}- markRecordingPaused(Date.now());- setPaused(true);})();}}, [markRecordingPaused, paused, recording]);@@ -1478,13 +1480,14 @@ export function useScreenRecorder(): UseScreenRecorderReturn {if (webcamRecorder.current?.state === "paused") {webcamRecorder.current.resume();}+ const boundaryMs = Date.now();+ markRecordingResumed(boundaryMs);+ setPaused(false);try {await window.electronAPI.resumeCursorCapture();} catch (error) {console.warn("Failed to resume cursor capture:", error);}- markRecordingResumed(Date.now());- setPaused(false);})();return;}@@ -1494,13 +1497,14 @@ export function useScreenRecorder(): UseScreenRecorderReturn {webcamRecorder.current.resume();}void (async () => {+ const boundaryMs = Date.now();+ markRecordingResumed(boundaryMs);+ setPaused(false);try {await window.electronAPI.resumeCursorCapture();} catch (error) {console.warn("Failed to resume cursor capture:", error);}- markRecordingResumed(Date.now());- setPaused(false);})();}}, [markRecordingResumed, paused, recording]);diff --git a/src/lib/exporter/modernFrameRenderer.ts b/src/lib/exporter/modernFrameRenderer.tsindex 66afce25..570409be 100644--- a/src/lib/exporter/modernFrameRenderer.ts+++ b/src/lib/exporter/modernFrameRenderer.ts@@ -1642,6 +1642,7 @@ export class FrameRenderer {) {this.backgroundForwardFrameDurationSec = resolvedDecodedDuration ?? null;this.closeBackgroundDecodedFrame();+ decodedFrame?.close();try {await this.restartBackgroundForwardFrameSource();normalizedTargetTime =@@ -2647,6 +2648,7 @@ export class FrameRenderer {false,);}+ this.updateCaptionLayer(resolvedSnapshot.timeMs);const hasOverlayCanvasWork =(this.config.annotationRegions?.length ?? 0) > 0 ||