Skip to content

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

feat(editor): make "fill frame" an action with a picker, not a switch

Etienne Lescotb1e8f613839d
diff --git a/src/components/ai-edition/NewEditorShell.module.css b/src/components/ai-edition/NewEditorShell.module.css
index ea4249683..92f2790b0 100644
--- a/src/components/ai-edition/NewEditorShell.module.css
+++ b/src/components/ai-edition/NewEditorShell.module.css
@@ -987,12 +987,71 @@
color: var(--fg-2);
margin: 4px var(--sp-4) 8px;
}
-/* Clip count riding along a shape chip — present, but never louder than the shape. */
-.tabCount {
- margin-left: 5px;
- opacity: 0.6;
+/* ─── row action + its menu ───────────────────────────────────── */
+/* Sits where a Toggle would, and reads as the current answer rather than as on/off. */
+.rowAction {
+ display: inline-flex;
+ align-items: center;
+ gap: 5px;
+ padding: 5px 8px;
+ border: 1px solid var(--border);
+ border-radius: 8px;
+ background: var(--bg);
+ color: var(--fg-2);
+ font: 500 var(--fs-app-sm)/1 var(--font-body);
font-variant-numeric: tabular-nums;
+ cursor: pointer;
+ transition: border-color 150ms ease, color 150ms ease;
+}
+.rowAction:hover:not(:disabled) { border-color: var(--brand); color: var(--fg); }
+.rowAction:disabled { cursor: default; opacity: 0.5; }
+.actionMenu {
+ min-width: 216px;
+ padding: 6px;
+ border: 1px solid var(--border);
+ border-radius: 12px;
+ background: var(--surface-1);
+ box-shadow: var(--elev-pop);
+ /* Ten shapes must cost no more room than two. */
+ max-height: min(var(--radix-popover-content-available-height, 60vh), 320px);
+ overflow-y: auto;
+ scrollbar-width: thin;
+ scrollbar-color: var(--border) transparent;
+}
+.actionMenuTitle {
+ margin: 4px 8px 6px;
+ font: 600 11px/1 var(--font-body);
+ text-transform: uppercase;
+ letter-spacing: 0.04em;
+ color: var(--muted);
+}
+.actionMenuRow {
+ display: flex;
+ align-items: baseline;
+ gap: 8px;
+ width: 100%;
+ padding: 7px 8px;
+ border: 0;
+ border-radius: 8px;
+ background: transparent;
+ color: var(--fg);
+ cursor: pointer;
+ text-align: left;
+}
+.actionMenuRow:hover { background: var(--surface-2); }
+.actionMenuRow.isActive { background: color-mix(in oklab, var(--brand), transparent 82%); }
+/* Resolution leads: it is the thing a user recognises about their own footage. */
+.actionMenuMain { font: 600 12.5px var(--font-display); font-variant-numeric: tabular-nums; }
+/* The ratio token second, for whoever does read them — `64:27` means nothing alone. */
+.actionMenuMeta { font: 400 11px var(--font-body); color: var(--muted); }
+.actionMenuCount {
+ margin-left: auto;
+ font: 500 11px var(--font-body);
+ font-variant-numeric: tabular-nums;
+ color: var(--meta);
}
+.actionMenuReset { border-top: 1px solid var(--border-soft); border-radius: 0 0 8px 8px; margin-top: 4px; padding-top: 10px; }
+.actionMenuReset .actionMenuMain { font-weight: 500; color: var(--fg-2); }
/* Caveat under a control, when the control is true but not the whole story. */
.paneHint {
diff --git a/src/components/ai-edition/RightPanes.tsx b/src/components/ai-edition/RightPanes.tsx
index d3c000a45..b3c93af7e 100644
--- a/src/components/ai-edition/RightPanes.tsx
+++ b/src/components/ai-edition/RightPanes.tsx
@@ -1548,11 +1548,15 @@ export function VideoEffectsPane() {
// contain-fits (see compositeLayout.ts), so anything not in the chosen shape keeps its
// bars. The switch is honest about the SETTINGS; without this it would also be read as a
// claim about the picture, and be wrong on every mixed timeline.
+ const filledFormat = frameIsFilled
+ ? nativeFormats.find((f) => f.token === settings.aspectRatio)
+ : undefined;
const clipsStillFramed = useMemo(() => {
const filled = nativeFormats.find((f) => f.token === settings.aspectRatio);
const total = nativeFormats.reduce((n, f) => n + f.clipCount, 0);
return total - (filled?.clipCount ?? 0);
}, [nativeFormats, settings.aspectRatio]);
+ const [fillMenuOpen, setFillMenuOpen] = useState(false);
// 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
@@ -1563,8 +1567,7 @@ 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);
+ const pushFramePatch = (patch: EditorSettingsPatch) => {
void set(patch);
if (isNativeCompositorActive()) {
setNativeParam("padding", (patch.padding ?? 0) / 100);
@@ -1572,6 +1575,11 @@ export function VideoEffectsPane() {
setNativeParam("shadow", patch.shadowIntensity ?? 0);
}
};
+ /** Fill to a shape the user named. */
+ const applyFillFrame = (token: AspectRatio) => pushFramePatch(fillFramePatch(true, token));
+ /** Fill to the majority shape, or restore — the no-decision-to-make path. */
+ const toggleFillFrame = (on: boolean) =>
+ pushFramePatch(fillFramePatch(on, nativeFormats[0]?.token ?? settings.aspectRatio));
return (
<Pane
@@ -1585,45 +1593,97 @@ 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. */}
+ three places, so nobody found it. This is that answer as one control.
+
+ An ACTION, not a switch. A switch has room for one outcome, and on a timeline
+ with several shapes there are several — one per shape — with no way for a
+ boolean to say which it took. It took the majority, silently. Worse, the shapes
+ it was choosing between were shown as raw ratio tokens: `16:9` is readable,
+ `683:384` and `64:27` are not, and ten of them do not fit a row of chips.
+
+ So the button says what is filling the frame right now, and opens a list when
+ there is a choice to make — the same shape the "edit clip" rail button has.
+ Rows lead with the RESOLUTION, which users recognise, and carry their clip
+ count so the trade is visible. The list scrolls, so ten shapes cost no more
+ than two. */}
<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>
- {/* WHICH shape to fill is only a question when the timeline has more than one, and
- then it is the user's to answer, not ours: picking the majority silently means a
- project that is mostly landscape with two portrait inserts can never be made to
- fill on the portrait ones. Each shape carries its clip count, so the trade is
- visible — same information the ratio menu's ORIGINAL section shows. */}
- {frameIsFilled && nativeFormats.length > 1 ? (
- <>
- <div className={styles.paneTabs} role="group" aria-label={ts("effects.fillFrame")}>
- {nativeFormats.map((format) => (
- <button
- type="button"
- key={format.token}
- className={format.token === settings.aspectRatio ? styles.isActive : ""}
- onClick={() => void set({ aspectRatio: format.token })}
- >
- {format.token}
- <span className={styles.tabCount}>{format.clipCount}</span>
- </button>
- ))}
- </div>
- {clipsStillFramed > 0 ? (
- <div className={styles.paneHint} role="note">
- {ts("effects.fillFrameMixed")}
+ <Popover open={fillMenuOpen} onOpenChange={setFillMenuOpen}>
+ <PopoverTrigger asChild>
+ <button
+ type="button"
+ className={styles.rowAction}
+ disabled={!hasDocument || nativeFormats.length === 0}
+ onClick={(e) => {
+ // One shape means no decision to delegate: act, do not ask.
+ if (nativeFormats.length <= 1) {
+ e.preventDefault();
+ toggleFillFrame(!frameIsFilled);
+ }
+ }}
+ >
+ {filledFormat
+ ? `${filledFormat.width} × ${filledFormat.height}`
+ : ts("effects.fillFrameOff")}
+ {nativeFormats.length > 1 ? <ChevronDown size={11} /> : null}
+ </button>
+ </PopoverTrigger>
+ <PopoverContent
+ align="end"
+ sideOffset={6}
+ collisionPadding={12}
+ animated={false}
+ className="w-auto border-0 bg-transparent p-0 shadow-none"
+ >
+ <div
+ className={styles.actionMenu}
+ role="menu"
+ aria-label={ts("effects.fillFrameChoose")}
+ >
+ <p className={styles.actionMenuTitle}>{ts("effects.fillFrameChoose")}</p>
+ {nativeFormats.map((format) => (
+ <button
+ type="button"
+ role="menuitem"
+ key={format.token}
+ className={`${styles.actionMenuRow}${
+ frameIsFilled && format.token === settings.aspectRatio
+ ? ` ${styles.isActive}`
+ : ""
+ }`}
+ onClick={() => {
+ setFillMenuOpen(false);
+ applyFillFrame(format.token);
+ }}
+ >
+ <span className={styles.actionMenuMain}>
+ {format.width} × {format.height}
+ </span>
+ <span className={styles.actionMenuMeta}>{format.token}</span>
+ <span className={styles.actionMenuCount}>{format.clipCount}</span>
+ </button>
+ ))}
+ {frameIsFilled ? (
+ <button
+ type="button"
+ role="menuitem"
+ className={`${styles.actionMenuRow} ${styles.actionMenuReset}`}
+ onClick={() => {
+ setFillMenuOpen(false);
+ toggleFillFrame(false);
+ }}
+ >
+ <span className={styles.actionMenuMain}>{ts("effects.fillFrameRestore")}</span>
+ </button>
+ ) : null}
</div>
- ) : null}
- </>
+ </PopoverContent>
+ </Popover>
+ </div>
+ {frameIsFilled && clipsStillFramed > 0 ? (
+ <div className={styles.paneHint} role="note">
+ {ts("effects.fillFrameMixed")}
+ </div>
) : null}
<div className={styles.sliderGrid}>
<SliderCell
diff --git a/src/components/ai-edition/fillFrameShapes.test.tsx b/src/components/ai-edition/fillFrameShapes.test.tsx
index cc3ac7b1a..258b699a3 100644
--- a/src/components/ai-edition/fillFrameShapes.test.tsx
+++ b/src/components/ai-edition/fillFrameShapes.test.tsx
@@ -5,7 +5,7 @@
// document, with clips of two shapes, and the frame already zeroed — so it gets its own file.
import "@testing-library/jest-dom";
-import { cleanup, render, screen } from "@testing-library/react";
+import { cleanup, fireEvent, render, screen, within } from "@testing-library/react";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { I18nProvider } from "@/contexts/I18nContext";
import type { AxcutDocument } from "@/lib/ai-edition/schema";
@@ -68,6 +68,13 @@ beforeEach(() => {
afterEach(cleanup);
describe("a mixed timeline gets a shape to choose, not a shape imposed", () => {
+ it("names the current fill by RESOLUTION, not by ratio token", () => {
+ // `16:9` is readable; `683:384` and `64:27` are not. What a user recognises about
+ // their own footage is its resolution, so that is what the control says.
+ mount(documentWithShapes([[1920, 1080]]));
+ expect(screen.getByRole("button", { name: /1920 × 1080/ })).toBeInTheDocument();
+ });
+
it("offers every distinct shape, with the clip count behind each", () => {
// Five landscape clips and two portrait inserts: picking the majority silently would
// mean the portrait ones can never be made to fill.
@@ -82,11 +89,24 @@ describe("a mixed timeline gets a shape to choose, not a shape imposed", () => {
[1080, 1920],
]),
);
+ fireEvent.click(screen.getByRole("button", { name: /1920 × 1080/ }));
- expect(screen.getByRole("button", { name: /16:9/ })).toBeInTheDocument();
- expect(screen.getByRole("button", { name: /9:16/ })).toBeInTheDocument();
- expect(screen.getByRole("button", { name: /16:9\s*5/ })).toBeInTheDocument();
- expect(screen.getByRole("button", { name: /9:16\s*2/ })).toBeInTheDocument();
+ const menu = screen.getByRole("menu");
+ expect(within(menu).getByRole("menuitem", { name: /1920 × 1080.*5/ })).toBeInTheDocument();
+ expect(within(menu).getByRole("menuitem", { name: /1080 × 1920.*2/ })).toBeInTheDocument();
+ });
+
+ it("offers a way back out of the menu it opened", () => {
+ mount(
+ documentWithShapes([
+ [1920, 1080],
+ [1080, 1920],
+ ]),
+ );
+ fireEvent.click(screen.getByRole("button", { name: /1920 × 1080/ }));
+ expect(
+ within(screen.getByRole("menu")).getByRole("menuitem", { name: "Restore the frame" }),
+ ).toBeInTheDocument();
});
it("says the other shapes still show the background", () => {
@@ -101,15 +121,18 @@ describe("a mixed timeline gets a shape to choose, not a shape imposed", () => {
);
});
- it("offers no choice when every clip is the same shape — there is nothing to arbitrate", () => {
+ it("asks nothing when every clip is the same shape — the button just acts", () => {
mount(
documentWithShapes([
[1920, 1080],
[3840, 2160],
]),
);
- // 1920x1080 and 3840x2160 are both 16:9: one shape, so no chooser and no caveat.
+ // 1920x1080 and 3840x2160 are both 16:9, so they collapse to ONE shape — labelled with
+ // the biggest representative, the same rule the ratio menu uses so the label shows the
+ // best resolution available. One shape means no menu and no caveat.
+ fireEvent.click(screen.getByRole("button", { name: /3840 × 2160/ }));
+ expect(screen.queryByRole("menu")).not.toBeInTheDocument();
expect(screen.queryByRole("note")).not.toBeInTheDocument();
- expect(screen.queryByRole("group")).not.toBeInTheDocument();
});
});
diff --git a/src/i18n/locales/ar/settings.json b/src/i18n/locales/ar/settings.json
index e1a9eebf0..66fe5098c 100644
--- a/src/i18n/locales/ar/settings.json
+++ b/src/i18n/locales/ar/settings.json
@@ -76,6 +76,9 @@
"padding": "المسافة البادئة",
"frame": "الإطار",
"fillFrame": "ملء الإطار",
+ "fillFrameOff": "مُعطَّل",
+ "fillFrameChoose": "اختر ما يملأ الإطار",
+ "fillFrameRestore": "استعادة الإطار",
"fillFrameMixed": "المقاطع ذات الشكل المختلف لا تزال تُظهر الخلفية.",
"motion": "الحركة",
"help": "تنسيق إطار التسجيل: ضبابية الخلفية، والظل، وضبابية الحركة، واستدارة الزوايا، والحشو حول الفيديو."
diff --git a/src/i18n/locales/en/settings.json b/src/i18n/locales/en/settings.json
index f4c16ca36..4c526baf2 100644
--- a/src/i18n/locales/en/settings.json
+++ b/src/i18n/locales/en/settings.json
@@ -82,6 +82,9 @@
"padding": "Padding",
"frame": "Frame",
"fillFrame": "Fill frame",
+ "fillFrameOff": "Off",
+ "fillFrameChoose": "Choose what fills the frame",
+ "fillFrameRestore": "Restore the frame",
"fillFrameMixed": "Clips in another shape still show the background.",
"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.json
index c0736ddad..14a7b88fb 100644
--- a/src/i18n/locales/es/settings.json
+++ b/src/i18n/locales/es/settings.json
@@ -75,6 +75,9 @@
"padding": "Relleno",
"frame": "Marco",
"fillFrame": "Llenar el marco",
+ "fillFrameOff": "Desactivado",
+ "fillFrameChoose": "Elige qué llena el marco",
+ "fillFrameRestore": "Restaurar el marco",
"fillFrameMixed": "Los clips con otra forma siguen mostrando el fondo.",
"motion": "Movimiento",
"on": "activado",
diff --git a/src/i18n/locales/fr/settings.json b/src/i18n/locales/fr/settings.json
index 4fd9c4a08..e88161a9b 100644
--- a/src/i18n/locales/fr/settings.json
+++ b/src/i18n/locales/fr/settings.json
@@ -75,6 +75,9 @@
"padding": "Marge",
"frame": "Cadre",
"fillFrame": "Plein cadre",
+ "fillFrameOff": "Désactivé",
+ "fillFrameChoose": "Choisir ce qui remplit le cadre",
+ "fillFrameRestore": "Rétablir le cadre",
"fillFrameMixed": "Les clips d'une autre forme affichent encore le fond.",
"motion": "Mouvement",
"on": "activé",
diff --git a/src/i18n/locales/it/settings.json b/src/i18n/locales/it/settings.json
index e5da5b5a7..e5c41dfd8 100644
--- a/src/i18n/locales/it/settings.json
+++ b/src/i18n/locales/it/settings.json
@@ -76,6 +76,9 @@
"padding": "Spaziatura",
"frame": "Cornice",
"fillFrame": "Riempi la cornice",
+ "fillFrameOff": "Disattivato",
+ "fillFrameChoose": "Scegli cosa riempie la cornice",
+ "fillFrameRestore": "Ripristina la cornice",
"fillFrameMixed": "Le clip con un'altra forma mostrano ancora lo sfondo.",
"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.json
index ee0246775..7d79d20c2 100644
--- a/src/i18n/locales/ja-JP/settings.json
+++ b/src/i18n/locales/ja-JP/settings.json
@@ -75,6 +75,9 @@
"padding": "余白",
"frame": "フレーム",
"fillFrame": "フレームいっぱい",
+ "fillFrameOff": "オフ",
+ "fillFrameChoose": "フレームを埋める対象を選択",
+ "fillFrameRestore": "フレームを元に戻す",
"fillFrameMixed": "別の形状のクリップには背景が残ります。",
"motion": "モーション",
"on": "オン",
diff --git a/src/i18n/locales/ko-KR/settings.json b/src/i18n/locales/ko-KR/settings.json
index b105588e2..52f9f8933 100644
--- a/src/i18n/locales/ko-KR/settings.json
+++ b/src/i18n/locales/ko-KR/settings.json
@@ -76,6 +76,9 @@
"padding": "여백",
"frame": "프레임",
"fillFrame": "프레임 채우기",
+ "fillFrameOff": "끄기",
+ "fillFrameChoose": "프레임을 채울 대상 선택",
+ "fillFrameRestore": "프레임 되돌리기",
"fillFrameMixed": "다른 비율의 클립에는 배경이 그대로 남습니다.",
"motion": "모션",
"help": "녹화 프레임 스타일: 배경 흐림, 그림자, 모션 블러, 모서리 둥글기, 영상 주변 여백."
diff --git a/src/i18n/locales/pt-BR/settings.json b/src/i18n/locales/pt-BR/settings.json
index 550392d35..1ed47a38b 100644
--- a/src/i18n/locales/pt-BR/settings.json
+++ b/src/i18n/locales/pt-BR/settings.json
@@ -76,6 +76,9 @@
"padding": "Espaçamento",
"frame": "Moldura",
"fillFrame": "Preencher a moldura",
+ "fillFrameOff": "Desativado",
+ "fillFrameChoose": "Escolha o que preenche a moldura",
+ "fillFrameRestore": "Restaurar a moldura",
"fillFrameMixed": "Clipes com outro formato ainda mostram o fundo.",
"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.json
index a704885ad..8ed1d6886 100644
--- a/src/i18n/locales/ru/settings.json
+++ b/src/i18n/locales/ru/settings.json
@@ -76,6 +76,9 @@
"padding": "Отступ",
"frame": "Рамка",
"fillFrame": "Во весь кадр",
+ "fillFrameOff": "Выключено",
+ "fillFrameChoose": "Выберите, чем заполнить кадр",
+ "fillFrameRestore": "Вернуть рамку",
"fillFrameMixed": "Клипы другой формы по-прежнему показывают фон.",
"motion": "Движение",
"help": "Оформление кадра записи: размытие фона, тень, размытие движения, скругление углов и отступ вокруг видео."
diff --git a/src/i18n/locales/tr/settings.json b/src/i18n/locales/tr/settings.json
index 4e0e7278e..0b4e0b4bc 100644
--- a/src/i18n/locales/tr/settings.json
+++ b/src/i18n/locales/tr/settings.json
@@ -75,6 +75,9 @@
"padding": "Dolgu",
"frame": "Çerçeve",
"fillFrame": "Çerçeveyi doldur",
+ "fillFrameOff": "Kapalı",
+ "fillFrameChoose": "Çerçeveyi neyin dolduracağını seçin",
+ "fillFrameRestore": "Çerçeveyi geri yükle",
"fillFrameMixed": "Başka bir orandaki klipler arka planı göstermeye devam eder.",
"motion": "Hareket",
"on": "açık",
diff --git a/src/i18n/locales/vi/settings.json b/src/i18n/locales/vi/settings.json
index a5b68fac3..729af6b18 100644
--- a/src/i18n/locales/vi/settings.json
+++ b/src/i18n/locales/vi/settings.json
@@ -75,6 +75,9 @@
"padding": "Phần đệm",
"frame": "Khung",
"fillFrame": "Lấp đầy khung",
+ "fillFrameOff": "Tắt",
+ "fillFrameChoose": "Chọn nội dung lấp đầy khung",
+ "fillFrameRestore": "Khôi phục khung",
"fillFrameMixed": "Các clip có tỉ lệ khác vẫn hiển thị nền.",
"motion": "Chuyển động",
"on": "bật",
diff --git a/src/i18n/locales/zh-CN/settings.json b/src/i18n/locales/zh-CN/settings.json
index fc7b87c3f..a3c522359 100644
--- a/src/i18n/locales/zh-CN/settings.json
+++ b/src/i18n/locales/zh-CN/settings.json
@@ -75,6 +75,9 @@
"padding": "内边距",
"frame": "画框",
"fillFrame": "填满画框",
+ "fillFrameOff": "关闭",
+ "fillFrameChoose": "选择填满画框的内容",
+ "fillFrameRestore": "恢复画框",
"fillFrameMixed": "其他比例的片段仍会显示背景。",
"motion": "运动",
"on": "开",
diff --git a/src/i18n/locales/zh-TW/settings.json b/src/i18n/locales/zh-TW/settings.json
index dc3f01c1a..89f31bcb8 100644
--- a/src/i18n/locales/zh-TW/settings.json
+++ b/src/i18n/locales/zh-TW/settings.json
@@ -76,6 +76,9 @@
"padding": "內邊距",
"frame": "外框",
"fillFrame": "填滿外框",
+ "fillFrameOff": "關閉",
+ "fillFrameChoose": "選擇填滿外框的內容",
+ "fillFrameRestore": "還原外框",
"fillFrameMixed": "其他比例的片段仍會顯示背景。",
"motion": "動態",
"on": "開",