Create polished demo videos without editing skills. Mac/Windows/Linux
fix: address PR review regressions
webadderallc4e60e7f057f
diff --git a/electron/electron-env.d.ts b/electron/electron-env.d.tsindex d7ba1fe9..d46b4770 100644--- a/electron/electron-env.d.ts+++ b/electron/electron-env.d.ts@@ -151,12 +151,12 @@ interface Window {message?: string;error?: string;}>;- pauseCursorCapture: () => Promise<{+ pauseCursorCapture: (boundaryMs?: number) => Promise<{success: boolean;message?: string;error?: string;}>;- resumeCursorCapture: () => Promise<{+ resumeCursorCapture: (boundaryMs?: number) => Promise<{success: boolean;message?: string;error?: string;diff --git a/electron/preload.ts b/electron/preload.tsindex acc756e8..fb1f9f5e 100644--- a/electron/preload.ts+++ b/electron/preload.ts@@ -293,11 +293,11 @@ contextBridge.exposeInMainWorld("electronAPI", {resumeNativeScreenRecording: () => {return ipcRenderer.invoke("resume-native-screen-recording");},- pauseCursorCapture: () => {- return ipcRenderer.invoke("pause-cursor-capture");+ pauseCursorCapture: (boundaryMs?: number) => {+ return ipcRenderer.invoke("pause-cursor-capture", boundaryMs);},- resumeCursorCapture: () => {- return ipcRenderer.invoke("resume-cursor-capture");+ resumeCursorCapture: (boundaryMs?: number) => {+ return ipcRenderer.invoke("resume-cursor-capture", boundaryMs);},startFfmpegRecording: (source: ProcessedDesktopSource) => {return ipcRenderer.invoke("start-ffmpeg-recording", source);diff --git a/src/components/video-editor/VideoEditor.tsx b/src/components/video-editor/VideoEditor.tsxindex cb184632..89911aa7 100644--- a/src/components/video-editor/VideoEditor.tsx+++ b/src/components/video-editor/VideoEditor.tsx@@ -3076,7 +3076,12 @@ export default function VideoEditor() {autoFullTrackClipIdRef.current = id;autoFullTrackClipEndMsRef.current = totalMs;if (trimRegions.length > 0) {- setClipRegions(trimsToClips(trimRegions, totalMs));+ const derivedClipRegions = trimsToClips(trimRegions, totalMs);+ nextClipIdRef.current = deriveNextId(+ "clip",+ derivedClipRegions.map((region) => region.id),+ );+ setClipRegions(derivedClipRegions);clipInitializedRef.current = true;return;}diff --git a/src/components/video-editor/timeline/TimelineEditor.tsx b/src/components/video-editor/timeline/TimelineEditor.tsxindex 538337b9..bb591220 100644--- a/src/components/video-editor/timeline/TimelineEditor.tsx+++ b/src/components/video-editor/timeline/TimelineEditor.tsx@@ -1479,10 +1479,15 @@ const TimelineEditor = forwardRef<TimelineEditorHandle, TimelineEditorProps>(const activeClip = clipRegions.find((clip) => startPos >= clip.startMs && startPos < clip.endMs,);+ const nextClip = clipRegions.find((clip) => clip.startMs > startPos);const sorted = [...zoomRegions].sort((a, b) => a.startMs - b.startMs);const nextRegion = sorted.find((region) => region.startMs > startPos);- const gapToNextClipEdge = activeClip ? activeClip.endMs - startPos : totalMs - startPos;+ const gapToNextClipEdge = activeClip+ ? activeClip.endMs - startPos+ : nextClip+ ? nextClip.startMs - startPos+ : 0;const gapToNextRegion = nextRegion ? nextRegion.startMs - startPos : totalMs - startPos;const availableDuration = Math.min(gapToNextClipEdge, gapToNextRegion);@@ -1490,7 +1495,7 @@ const TimelineEditor = forwardRef<TimelineEditorHandle, TimelineEditorProps>((region) => startPos >= region.startMs && startPos < region.endMs,);- return !isOverlapping && availableDuration >= defaultDuration;+ return !isOverlapping && availableDuration >= defaultRegionDurationMs;},[videoDuration, totalMs, zoomRegions, defaultRegionDurationMs, clipRegions],);diff --git a/src/components/video-editor/types.test.ts b/src/components/video-editor/types.test.tsindex 12a63cb3..4333ce5e 100644--- a/src/components/video-editor/types.test.ts+++ b/src/components/video-editor/types.test.ts@@ -5,7 +5,9 @@ import {findClipAtTimelineTime,mapSourceTimeToTimelineTime,mapTimelineTimeToSourceTime,+ trimsToClips,} from "./types";+import { deriveNextId } from "./projectPersistence";describe("extendAutoFullTrackClip", () => {it("extends the default full-track clip when metadata duration grows", () => {@@ -141,4 +143,17 @@ describe("clip timeline mapping", () => {expect(findClipAtTimelineTime(500, clips)?.id).toBe("clip-1");expect(findClipAtTimelineTime(5_000, clips)).toBeNull();});++ it("derives the next clip id after converting trim gaps into clip ids", () => {+ const clipsFromTrims = trimsToClips(+ [+ { id: "trim-gap-1", startMs: 1_000, endMs: 2_000 },+ { id: "trim-gap-2", startMs: 4_000, endMs: 5_000 },+ ],+ 6_000,+ );++ expect(clipsFromTrims.map((clip) => clip.id)).toEqual(["clip-1", "clip-2", "clip-3"]);+ expect(deriveNextId("clip", clipsFromTrims.map((clip) => clip.id))).toBe(4);+ });});