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(editor): one switch for "no background", derived from the four settings
Etienne Lescot5d3c2d28de06
diff --git a/src/components/ai-edition/RightPanes.tsx b/src/components/ai-edition/RightPanes.tsxindex 988ad0e18..548fea944 100644--- a/src/components/ai-edition/RightPanes.tsx+++ b/src/components/ai-edition/RightPanes.tsx@@ -37,6 +37,7 @@ import defaultCursorPreviewUrl from "@/assets/cursors/Cursor=Default.svg";import GradientEditor, { type GradientEditorState } from "@/components/ui/gradient-editor";import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover";import { useScopedT } from "@/contexts/I18nContext";+import { collectNativeFormats } from "@/lib/ai-edition/document/outputFormat";import type {AxcutAsset,AxcutClip,@@ -44,7 +45,12 @@ import type {AxcutTrimRange,AxcutWord,} from "@/lib/ai-edition/schema";-import { AUDIO_GAIN_DB_LIMIT } from "@/lib/ai-edition/store/editorSettings";+import {+ AUDIO_GAIN_DB_LIMIT,+ DEFAULT_EDITOR_SETTINGS,+ type EditorSettingsPatch,+ type EditorSettingsSnapshot,+} from "@/lib/ai-edition/store/editorSettings";import { useProjectStore } from "@/lib/ai-edition/store/projectStore";import { useEditorSettings } from "@/lib/ai-edition/store/useEditorSettings";import {@@ -71,6 +77,7 @@ import {WALLPAPER_THUMB_PATHS,} from "@/lib/wallpaper";import { isNativeCompositorActive, setNativeParam } from "@/native";+import type { AspectRatio } from "@/utils/aspectRatioUtils";import styles from "./NewEditorShell.module.css";interface PaneProps {@@ -1439,6 +1446,57 @@ function restoreCaretBeforeWord(editor: HTMLElement | null, wordId: string): voi// pulling the schema into the helpers block.export type { AxcutWord };+// ─── Fill frame ────────────────────────────────────────────────────++/**+ * Does the recording cover the whole output frame — i.e. is no background visible?+ *+ * DERIVED, never stored. "No background" is a fact about four settings, not a fifth setting+ * alongside them, and storing it would immediately be able to disagree with them: nudge the+ * padding slider and a stored flag still claims the background is off. Reading it back keeps+ * the toggle honest for free, needs no schema change, and survives a reload.+ *+ * The aspect ratio is part of the test and not an afterthought — padding 0 only fills the+ * WIDTH. A 16:10 capture in a 16:9 project still shows wallpaper bars top and bottom at zero+ * padding, which is exactly why #84 reads as unfixable to someone who found the slider.+ */+export function fillsFrame(+ settings: Pick<+ EditorSettingsSnapshot,+ "padding" | "borderRadius" | "shadowIntensity" | "aspectRatio"+ >,+ nativeTokens: ReadonlySet<AspectRatio>,+): boolean {+ return (+ settings.padding === 0 &&+ settings.borderRadius === 0 &&+ settings.shadowIntensity === 0 &&+ nativeTokens.has(settings.aspectRatio)+ );+}++/**+ * The patch behind the toggle.+ *+ * Turning it OFF restores the shipped defaults rather than whatever the user had before:+ * "before" would have to be stored somewhere, and a hidden slot that only one control writes+ * is the kind of state that rots. Predictable beats clever here — and every value it restores+ * is one slider away.+ *+ * `aspectRatio` is deliberately absent from the OFF patch. Turning the background back on does+ * not mean the user wanted their output reframed; the three frame values alone bring it back.+ */+export function fillFramePatch(on: boolean, nativeToken: AspectRatio): EditorSettingsPatch {+ if (!on) {+ return {+ padding: DEFAULT_EDITOR_SETTINGS.padding,+ borderRadius: DEFAULT_EDITOR_SETTINGS.borderRadius,+ shadowIntensity: DEFAULT_EDITOR_SETTINGS.shadowIntensity,+ };+ }+ return { padding: 0, borderRadius: 0, shadowIntensity: 0, aspectRatio: nativeToken };+}+// ─── Video Effects ─────────────────────────────────────────────────/**@@ -1456,7 +1514,15 @@ export type { AxcutWord };*/export function VideoEffectsPane() {const ts = useScopedT("settings");- const { settings, setLive, commit, hasDocument } = useEditorSettings();+ const { settings, set, setLive, commit, hasDocument } = useEditorSettings();+ const document = useProjectStore((s) => s.document);++ // Same source the ratio picker reads, so "fill frame" and the ORIGINAL section of that menu+ // can never disagree about what shape the footage is. Already sorted by clip count then by+ // pixel area, so [0] is "the shape most of this timeline is in" with no heuristic of ours.+ const nativeFormats = useMemo(() => (document ? collectNativeFormats(document) : []), [document]);+ const nativeTokens = useMemo(() => new Set(nativeFormats.map((f) => f.token)), [nativeFormats]);+ const frameIsFilled = fillsFrame(settings, nativeTokens);// Le rayon natif = rayon de base de la fixture (~24px @1920) × cette échelle. Diviser la// valeur px de l'UI par ce même rayon de base fait que le coin natif ≈ les px affichés@@ -1467,6 +1533,16 @@ export function VideoEffectsPane() {// un effet de montage ici ne poussait rien tant que ce panneau precis n'avait pas// ete ouvert. Les handlers par controle ci-dessous poussent toujours leurs diffs.+ const toggleFillFrame = (on: boolean) => {+ const patch = fillFramePatch(on, nativeFormats[0]?.token ?? settings.aspectRatio);+ void set(patch);+ if (isNativeCompositorActive()) {+ setNativeParam("padding", (patch.padding ?? 0) / 100);+ setNativeParam("roundness", (patch.borderRadius ?? 0) / NATIVE_SCREEN_BASE_RADIUS_PX);+ setNativeParam("shadow", patch.shadowIntensity ?? 0);+ }+ };+return (<Panetitle={ts("effects.title")}@@ -1478,6 +1554,20 @@ export function VideoEffectsPane() {><BackgroundSection /><div className={styles.sectionLabel}>{ts("effects.frame")}</div>+ {/* #84: "how do I turn the background off". The honest answer was four settings in+ three places, so nobody found it. This is that answer as one control — and it+ stays a derived view of those settings, so moving any slider below simply turns+ it back off rather than leaving a lying switch behind. Disabled without a+ timeline: there is no footage whose shape we could fill to. */}+ <div className={styles.paneRow}>+ <span className={styles.label}>{ts("effects.fillFrame")}</span>+ <Toggle+ checked={frameIsFilled}+ disabled={!hasDocument || nativeFormats.length === 0}+ ariaLabel={ts("effects.fillFrame")}+ onChange={toggleFillFrame}+ />+ </div><div className={styles.sliderGrid}><SliderCelllabel={ts("effects.shadow")}@@ -2040,10 +2130,14 @@ export function CursorPane() {export function Toggle({checked,disabled,+ ariaLabel,onChange,}: {checked: boolean;disabled?: boolean;+ /** The switch renders no text of its own, so a screen reader has nothing to announce+ * unless a caller names it. Optional only because the existing call sites predate it. */+ ariaLabel?: string;onChange: (next: boolean) => void;}) {return (@@ -2051,6 +2145,7 @@ export function Toggle({type="button"className={`${styles.toggle} ${checked ? styles.isOn : ""}`}aria-pressed={checked}+ aria-label={ariaLabel}disabled={disabled}onClick={() => onChange(!checked)}/>diff --git a/src/components/ai-edition/fillFrame.test.ts b/src/components/ai-edition/fillFrame.test.tsnew file mode 100644index 000000000..5afeafa59--- /dev/null+++ b/src/components/ai-edition/fillFrame.test.ts@@ -0,0 +1,76 @@+// "Turn the background off" (#84) is not a setting — it is a shape four settings can be in.+// These pin that reading, because the failure mode is silent: a predicate that is too lax+// shows the toggle ON while wallpaper is still visible in the letterbox bars, which is the+// exact confusion the issue reports.++import { describe, expect, it } from "vitest";+import type { AspectRatio } from "@/utils/aspectRatioUtils";+import { fillFramePatch, fillsFrame } from "./RightPanes";++const FILLED = {+ padding: 0,+ borderRadius: 0,+ shadowIntensity: 0,+ aspectRatio: "16:10" as AspectRatio,+};+const NATIVE = new Set<AspectRatio>(["16:10"]);++describe("fillsFrame reads the four settings, not a stored flag", () => {+ it("is true when nothing can show through", () => {+ expect(fillsFrame(FILLED, NATIVE)).toBe(true);+ });++ it.each([+ ["padding", { padding: 1 }],+ ["roundness", { borderRadius: 0.5 }],+ ["shadow", { shadowIntensity: 0.01 }],+ ])("is false as soon as the %s lets the background back in", (_label, override) => {+ expect(fillsFrame({ ...FILLED, ...override }, NATIVE)).toBe(false);+ });++ it("is false when the output shape is not the footage's, however zeroed the frame is", () => {+ // The whole reason #84 reads as unfixable to someone who already found the padding+ // slider: a 16:10 capture in a 16:9 project keeps its wallpaper bars at padding 0,+ // because zero padding only fills the WIDTH.+ expect(fillsFrame({ ...FILLED, aspectRatio: "16:9" as AspectRatio }, NATIVE)).toBe(false);+ });++ it("accepts any of the timeline's shapes, not just the first", () => {+ const mixed = new Set<AspectRatio>(["16:9", "9:16"]);+ expect(fillsFrame({ ...FILLED, aspectRatio: "9:16" as AspectRatio }, mixed)).toBe(true);+ });++ it("is false for a timeline whose shapes are unknown", () => {+ // No clips probed yet — there is nothing to fill, so the toggle must not read ON.+ expect(fillsFrame(FILLED, new Set())).toBe(false);+ });+});++describe("fillFramePatch", () => {+ it("zeroes the three frame values and adopts the footage's shape", () => {+ expect(fillFramePatch(true, "16:10")).toEqual({+ padding: 0,+ borderRadius: 0,+ shadowIntensity: 0,+ aspectRatio: "16:10",+ });+ });++ it("round-trips: what it turns on, fillsFrame reads as on", () => {+ const patched = { ...FILLED, ...fillFramePatch(true, "16:10") };+ expect(fillsFrame(patched, NATIVE)).toBe(true);+ });++ it("restores the shipped defaults when switched off", () => {+ const off = fillFramePatch(false, "16:10");+ expect(off.padding).toBeGreaterThan(0);+ expect(off.borderRadius).toBeGreaterThan(0);+ expect(off.shadowIntensity).toBeGreaterThan(0);+ });++ it("leaves the aspect ratio alone when switched off", () => {+ // Wanting the background back is not asking for the output to be reframed, and the+ // three frame values alone bring it back.+ expect(fillFramePatch(false, "16:10")).not.toHaveProperty("aspectRatio");+ });+});diff --git a/src/i18n/locales/ar/settings.json b/src/i18n/locales/ar/settings.jsonindex a185fcdf4..4a139e1e9 100644--- a/src/i18n/locales/ar/settings.json+++ b/src/i18n/locales/ar/settings.json@@ -75,6 +75,7 @@"roundness": "الاستدارة","padding": "المسافة البادئة","frame": "الإطار",+ "fillFrame": "ملء الإطار","motion": "الحركة","help": "تنسيق إطار التسجيل: ضبابية الخلفية، والظل، وضبابية الحركة، واستدارة الزوايا، والحشو حول الفيديو."},diff --git a/src/i18n/locales/en/settings.json b/src/i18n/locales/en/settings.jsonindex 83cec83a3..1de8adcfe 100644--- a/src/i18n/locales/en/settings.json+++ b/src/i18n/locales/en/settings.json@@ -81,6 +81,7 @@"roundness": "Roundness","padding": "Padding","frame": "Frame",+ "fillFrame": "Fill frame","motion": "Motion","help": "Frame styling for the recording: background blur, drop shadow, motion blur, corner radius, and padding around the video."},diff --git a/src/i18n/locales/es/settings.json b/src/i18n/locales/es/settings.jsonindex 0536d1846..52208d6d1 100644--- a/src/i18n/locales/es/settings.json+++ b/src/i18n/locales/es/settings.json@@ -74,6 +74,7 @@"roundness": "Redondez","padding": "Relleno","frame": "Marco",+ "fillFrame": "Llenar el marco","motion": "Movimiento","on": "activado","help": "Estilo del marco de la grabación: desenfoque de fondo, sombra, desenfoque de movimiento, radio de esquinas y margen alrededor del vídeo."diff --git a/src/i18n/locales/fr/settings.json b/src/i18n/locales/fr/settings.jsonindex 31dff449b..e62aac1ed 100644--- a/src/i18n/locales/fr/settings.json+++ b/src/i18n/locales/fr/settings.json@@ -74,6 +74,7 @@"roundness": "Arrondi","padding": "Marge","frame": "Cadre",+ "fillFrame": "Plein cadre","motion": "Mouvement","on": "activé","help": "Mise en forme du cadre de l'enregistrement : flou d'arrière-plan, ombre portée, flou de mouvement, arrondi des coins et marge autour de la vidéo."diff --git a/src/i18n/locales/it/settings.json b/src/i18n/locales/it/settings.jsonindex b4b519fc2..f2b79fa9d 100644--- a/src/i18n/locales/it/settings.json+++ b/src/i18n/locales/it/settings.json@@ -75,6 +75,7 @@"roundness": "Arrotondamento","padding": "Spaziatura","frame": "Cornice",+ "fillFrame": "Riempi la cornice","motion": "Movimento","help": "Stile della cornice della registrazione: sfocatura dello sfondo, ombra, sfocatura di movimento, raggio degli angoli e margine attorno al video."},diff --git a/src/i18n/locales/ja-JP/settings.json b/src/i18n/locales/ja-JP/settings.jsonindex 8eae995c7..066b21cc1 100644--- a/src/i18n/locales/ja-JP/settings.json+++ b/src/i18n/locales/ja-JP/settings.json@@ -74,6 +74,7 @@"roundness": "丸み","padding": "余白","frame": "フレーム",+ "fillFrame": "フレームいっぱい","motion": "モーション","on": "オン","help": "録画フレームのスタイル設定: 背景ぼかし、ドロップシャドウ、モーションブラー、角丸、動画まわりの余白。"diff --git a/src/i18n/locales/ko-KR/settings.json b/src/i18n/locales/ko-KR/settings.jsonindex 75cb2584d..3114bad4c 100644--- a/src/i18n/locales/ko-KR/settings.json+++ b/src/i18n/locales/ko-KR/settings.json@@ -75,6 +75,7 @@"roundness": "모서리 둥글기","padding": "여백","frame": "프레임",+ "fillFrame": "프레임 채우기","motion": "모션","help": "녹화 프레임 스타일: 배경 흐림, 그림자, 모션 블러, 모서리 둥글기, 영상 주변 여백."},diff --git a/src/i18n/locales/pt-BR/settings.json b/src/i18n/locales/pt-BR/settings.jsonindex 54cf659af..e074edc6c 100644--- a/src/i18n/locales/pt-BR/settings.json+++ b/src/i18n/locales/pt-BR/settings.json@@ -75,6 +75,7 @@"roundness": "Arredondamento","padding": "Espaçamento","frame": "Moldura",+ "fillFrame": "Preencher a moldura","motion": "Movimento","help": "Estilo do quadro da gravação: desfoque de fundo, sombra, desfoque de movimento, raio dos cantos e margem em volta do vídeo."},diff --git a/src/i18n/locales/ru/settings.json b/src/i18n/locales/ru/settings.jsonindex 829fb2cf0..8c500fd0a 100644--- a/src/i18n/locales/ru/settings.json+++ b/src/i18n/locales/ru/settings.json@@ -75,6 +75,7 @@"roundness": "Скругление","padding": "Отступ","frame": "Рамка",+ "fillFrame": "Во весь кадр","motion": "Движение","help": "Оформление кадра записи: размытие фона, тень, размытие движения, скругление углов и отступ вокруг видео."},diff --git a/src/i18n/locales/tr/settings.json b/src/i18n/locales/tr/settings.jsonindex 57668b5d3..36c5687fa 100644--- a/src/i18n/locales/tr/settings.json+++ b/src/i18n/locales/tr/settings.json@@ -74,6 +74,7 @@"roundness": "Yuvarlaklık","padding": "Dolgu","frame": "Çerçeve",+ "fillFrame": "Çerçeveyi doldur","motion": "Hareket","on": "açık","help": "Kayıt çerçevesinin biçimi: arka plan bulanıklığı, gölge, hareket bulanıklığı, köşe yuvarlaklığı ve videonun çevresindeki boşluk."diff --git a/src/i18n/locales/vi/settings.json b/src/i18n/locales/vi/settings.jsonindex aa2599571..aeffb8a4b 100644--- a/src/i18n/locales/vi/settings.json+++ b/src/i18n/locales/vi/settings.json@@ -74,6 +74,7 @@"roundness": "Độ bo tròn","padding": "Phần đệm","frame": "Khung",+ "fillFrame": "Lấp đầy khung","motion": "Chuyển động","on": "bật","help": "Kiểu khung của bản ghi: làm mờ nền, đổ bóng, mờ chuyển động, bo góc và khoảng đệm quanh video."diff --git a/src/i18n/locales/zh-CN/settings.json b/src/i18n/locales/zh-CN/settings.jsonindex 7050a58b8..b6a2ad67d 100644--- a/src/i18n/locales/zh-CN/settings.json+++ b/src/i18n/locales/zh-CN/settings.json@@ -74,6 +74,7 @@"roundness": "圆角","padding": "内边距","frame": "画框",+ "fillFrame": "填满画框","motion": "运动","on": "开","help": "录制画面的边框样式:背景模糊、投影、运动模糊、圆角半径以及视频四周的内边距。"diff --git a/src/i18n/locales/zh-TW/settings.json b/src/i18n/locales/zh-TW/settings.jsonindex 6e8f63cc9..3aec2f390 100644--- a/src/i18n/locales/zh-TW/settings.json+++ b/src/i18n/locales/zh-TW/settings.json@@ -75,6 +75,7 @@"roundness": "圓角","padding": "內邊距","frame": "外框",+ "fillFrame": "填滿外框","motion": "動態","on": "開","help": "錄製畫面的外框樣式:背景模糊、陰影、動態模糊、圓角半徑,以及影片四周的內距。"