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
fix: headless export honors editor cursor tuning keys and cropRegion from v2 projects
jfkconstructd095ce346d71
diff --git a/src/components/video-editor/projectPersistence.test.ts b/src/components/video-editor/projectPersistence.test.tsindex ccd0404cf..fb9d477dd 100644--- a/src/components/video-editor/projectPersistence.test.ts+++ b/src/components/video-editor/projectPersistence.test.ts@@ -81,6 +81,36 @@ describe("projectPersistence media compatibility", () => {);});+ it("passes cursor tuning keys through so the CLI export can read them", () => {+ const editor = normalizeProjectEditor({+ cursorSize: 0.3,+ cursorSmoothing: 0.5,+ cursorMotionBlur: 0.1,+ cursorClickBounce: 1.5,+ cursorClipToBounds: true,+ });+ expect(editor).toMatchObject({+ cursorSize: 0.3,+ cursorSmoothing: 0.5,+ cursorMotionBlur: 0.1,+ cursorClickBounce: 1.5,+ cursorClipToBounds: true,+ });+ });++ it("omits cursor tuning keys that are absent or malformed", () => {+ const editor = normalizeProjectEditor({+ cursorSize: Number.NaN,+ cursorClickBounce: "big" as never,+ cursorClipToBounds: "yes" as never,+ });+ expect("cursorSize" in editor).toBe(false);+ expect("cursorSmoothing" in editor).toBe(false);+ expect("cursorMotionBlur" in editor).toBe(false);+ expect("cursorClickBounce" in editor).toBe(false);+ expect("cursorClipToBounds" in editor).toBe(false);+ });+it("normalizes webcam mask shape values safely", () => {expect(normalizeProjectEditor({ webcamMaskShape: "rounded" }).webcamMaskShape).toBe("rounded");expect(diff --git a/src/components/video-editor/projectPersistence.ts b/src/components/video-editor/projectPersistence.tsindex 8aa7f9992..e3b7b2a44 100644--- a/src/components/video-editor/projectPersistence.ts+++ b/src/components/video-editor/projectPersistence.ts@@ -100,6 +100,15 @@ export interface ProjectEditorState {gifLoop: boolean;gifSizePreset: GifSizePreset;cursorTheme: string;+ // Optional: the headless CLI export reads a v2 project through+ // normalizeProjectEditor and then copies the editor into legacyEditor, where+ // getEditorSettings reads these keys. A key missing here is a key the export+ // silently drops back to its default.+ cursorSize?: number;+ cursorSmoothing?: number;+ cursorMotionBlur?: number;+ cursorClickBounce?: number;+ cursorClipToBounds?: boolean;}export interface EditorProjectData {@@ -475,6 +484,20 @@ export function normalizeProjectEditor(editor: Partial<ProjectEditorState>): Proreturn {cursorTheme: normalizeCursorThemeId(editor.cursorTheme),+ // Pass the cursor tuning keys through when present; the CLI export has no+ // other path to them (the GUI edits the v7 document directly and never+ // comes back through here).+ ...(isFiniteNumber(editor.cursorSize) ? { cursorSize: editor.cursorSize } : {}),+ ...(isFiniteNumber(editor.cursorSmoothing) ? { cursorSmoothing: editor.cursorSmoothing } : {}),+ ...(isFiniteNumber(editor.cursorMotionBlur)+ ? { cursorMotionBlur: editor.cursorMotionBlur }+ : {}),+ ...(isFiniteNumber(editor.cursorClickBounce)+ ? { cursorClickBounce: editor.cursorClickBounce }+ : {}),+ ...(typeof editor.cursorClipToBounds === "boolean"+ ? { cursorClipToBounds: editor.cursorClipToBounds }+ : {}),wallpaper:typeof editor.wallpaper === "string"? normalizeWallpaperValue(editor.wallpaper)diff --git a/src/lib/ai-edition/document/migrate.test.ts b/src/lib/ai-edition/document/migrate.test.tsindex 0a365c568..af6d3ef16 100644--- a/src/lib/ai-edition/document/migrate.test.ts+++ b/src/lib/ai-edition/document/migrate.test.ts@@ -172,6 +172,33 @@ describe("migrateProjectDataToAxcutDocument", () => {expect(a.annotationSource).toBe("auto-caption");});+ it("carries a non-identity editor.cropRegion onto the migrated clip", () => {+ const v2 = makeV2Project();+ v2.editor.cropRegion = { x: 0.25, y: 0.25, width: 0.5, height: 0.5 };+ const doc = migrateProjectDataToAxcutDocument(v2);+ expect(doc.timeline.clips).toHaveLength(1);+ expect(doc.timeline.clips[0]?.cropRegion).toEqual({+ x: 0.25,+ y: 0.25,+ width: 0.5,+ height: 0.5,+ });+ });++ it("leaves the migrated clip without a cropRegion for the identity crop", () => {+ const doc = migrateProjectDataToAxcutDocument(makeV2Project());+ expect(doc.timeline.clips[0]?.cropRegion).toBeUndefined();+ });++ it("carries cursor tuning keys from a v2 editor into getEditorSettings", () => {+ const v2 = makeV2Project();+ v2.editor.cursorSize = 0.3;+ v2.editor.cursorClickBounce = 0;+ const settings = getEditorSettings(migrateProjectDataToAxcutDocument(v2));+ expect(settings.cursor.size).toBe(0.3);+ expect(settings.cursor.clickBounce).toBe(0);+ });+it("stores the v2 editor shape under legacyEditor for round-trip", () => {const v2 = makeV2Project();const doc = migrateProjectDataToAxcutDocument(v2);diff --git a/src/lib/ai-edition/document/migrate.ts b/src/lib/ai-edition/document/migrate.tsindex fdd967515..e76599daa 100644--- a/src/lib/ai-edition/document/migrate.ts+++ b/src/lib/ai-edition/document/migrate.ts@@ -74,6 +74,19 @@ function toLegacyMedia(input: ProjectMedia | undefined): ProjectMedia | null {return media;}+/**+ * A v2 `editor.cropRegion` becomes the migrated clip's crop. Returns null for a+ * missing, malformed, or identity region so the clip stays lean (see clipSchema).+ */+function toClipCropRegion(region: CropRegion | undefined): CropRegion | null {+ if (!region) return null;+ const { x, y, width, height } = region;+ const finite = [x, y, width, height].every((v) => typeof v === "number" && Number.isFinite(v));+ if (!finite) return null;+ if (x === 0 && y === 0 && width === 1 && height === 1) return null;+ return { x, y, width, height };+}+/*** Migrate a v2 EditorProjectData into a v3 AxcutDocument. The single recording* becomes one asset + one clip spanning the source. trimRegions become@@ -130,6 +143,8 @@ export function migrateProjectDataToAxcutDocument(? input.editor.annotationRegions: [];+ const migratedCropRegion = toClipCropRegion(input.editor?.cropRegion);+const clip = primaryAssetId? {id: createId("clip"),@@ -140,6 +155,10 @@ export function migrateProjectDataToAxcutDocument(wordRefs: [] as string[],origin: "system" as const,reason: "migrated from v2",+ // Crop lives on the clip in v3 (sceneDescription reads clip.cropRegion),+ // so a v2 editor.cropRegion left only in legacyEditor is never applied.+ // Identity stays absent so untouched clips remain lean.+ ...(migratedCropRegion ? { cropRegion: migratedCropRegion } : {}),}: null;