Skip to content

Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.

fix(mcp): offer auto only while the timeline holds one composition, keep the current format writable

EtienneLescot92261409c259
diff --git a/electron/ai-edition/editor-settings-tool.test.ts b/electron/ai-edition/editor-settings-tool.test.ts
index f86fa53a5..cb939a6c5 100644
--- a/electron/ai-edition/editor-settings-tool.test.ts
+++ b/electron/ai-edition/editor-settings-tool.test.ts
@@ -123,6 +123,31 @@ describe("setEditorSettings", () => {
const vertical = set(document, { aspectRatio: "9:16" });
expect(JSON.parse(vertical.resultJson).applied).toEqual(["aspectRatio", "formatFollowCursor"]);
expect(getEditorSettings(vertical.document as AxcutDocument).formatFollowCursor).toBe(true);
+ // Two shapes on the timeline: auto is not offered, as in the picker.
+ const mixed = documentSchema.parse({
+ ...document,
+ assets: [
+ ...document.assets,
+ { ...document.assets[0], id: "asset_2", video: { width: 1080, height: 1920 } },
+ ],
+ timeline: {
+ ...document.timeline,
+ clips: [
+ ...document.timeline.clips,
+ {
+ ...document.timeline.clips[0],
+ id: "clip_2",
+ assetId: "asset_2",
+ timelineStartSec: 30,
+ timelineEndSec: 60,
+ },
+ ],
+ },
+ });
+ expect(
+ set(set(mixed, { aspectRatio: "9:16" }).document as AxcutDocument, { aspectRatio: "auto" })
+ .ok,
+ ).toBe(false);
// The alias takes the same shapes.
expect(
executeAgentTool(document, "setAspectRatio", JSON.stringify({ aspectRatio: "683:384" })).ok,
diff --git a/electron/ai-edition/editor-settings-tool.ts b/electron/ai-edition/editor-settings-tool.ts
index d0660910c..9bae3c603 100644
--- a/electron/ai-edition/editor-settings-tool.ts
+++ b/electron/ai-edition/editor-settings-tool.ts
@@ -329,11 +329,14 @@ export function editorSettingsSnapshot(
};
}
-/** `"auto"`, a preset, or one of the timeline's own shapes: what the format picker offers. */
+/** What the format picker offers: auto (while the timeline holds one composition), a preset, or
+ * one of the timeline's own shapes. The current value always passes, so a read written back
+ * as is never fails on it. */
function aspectRatioError(document: AxcutDocument, value: string): string | null {
const original = collectNativeFormats(document).map((f) => f.token);
- const allowed = ["auto", ...ASPECT_RATIO_PRESETS, ...original];
- return allowed.includes(value)
+ const auto = isAutoFormatAvailable(document) ? ["auto"] : [];
+ const allowed = [...auto, ...ASPECT_RATIO_PRESETS, ...original];
+ return allowed.includes(value) || value === getEditorSettings(document).aspectRatio
? null
: `aspectRatio ${JSON.stringify(value)} is not offered for this project. Use one of: ${allowed.join(", ")}.`;
}