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): re-port gradients, the File menu, 100x speed and Full Camera into v4

Etienne Lescot4fa09011a599
diff --git a/src/components/ai-edition/NewEditorShell.tsx b/src/components/ai-edition/NewEditorShell.tsx
index 3e6aec464..dd698d4f0 100644
--- a/src/components/ai-edition/NewEditorShell.tsx
+++ b/src/components/ai-edition/NewEditorShell.tsx
@@ -630,6 +630,26 @@ export function NewEditorShell() {
}
}, [saveDocument]);
+ // Native File menu (electron/main.ts) → v4 actions. The menu is shown via
+ // Menu.setApplicationMenu and dispatches these IPC events; the old editor
+ // listened to them, but the v4 shell replaced it, leaving the File items
+ // dead. Wire them to the same handlers the top-bar buttons use so the
+ // File/Edit/View menu bar works again (Edit/View items use Electron roles).
+ // The v4 editor has no separate "Save As" location, so it maps to Save.
+ useEffect(() => {
+ const api = window.electronAPI;
+ if (!api) return;
+ const unsubscribers = [
+ api.onMenuNewProject?.(() => setNewProjectOpen(true)),
+ api.onMenuLoadProject?.(() => setOpenProjectOpen(true)),
+ api.onMenuSaveProject?.(() => void handleSave()),
+ api.onMenuSaveProjectAs?.(() => void handleSave()),
+ ];
+ return () => {
+ for (const unsub of unsubscribers) unsub?.();
+ };
+ }, [handleSave]);
+
const handleRenameProject = useCallback(
async (title: string) => {
const doc = useProjectStore.getState().document;
@@ -972,6 +992,11 @@ export function NewEditorShell() {
void tl.addSpeed();
return;
}
+ if (matchesShortcut(e, shortcuts.addCameraFullscreen, isMac)) {
+ e.preventDefault();
+ void tl.addCameraFullscreen();
+ return;
+ }
// Fixed (non-configurable) shortcuts advertised in the shortcuts dialog.
if (e.key === "Tab") {
@@ -1158,6 +1183,7 @@ export function NewEditorShell() {
clips={clips}
zoomRegions={tl.zoomRegions}
speedRegions={tl.speedRegions}
+ cameraFullscreenRegions={tl.cameraFullscreenRegions}
trimRanges={tl.trimRanges}
selectedZoomRegionId={tl.selection?.kind === "zoom" ? tl.selection.id : null}
onZoomFocusChange={tl.updateZoomFocusLive}
diff --git a/src/components/ai-edition/Preview.tsx b/src/components/ai-edition/Preview.tsx
index 1df426d10..5e1c75642 100644
--- a/src/components/ai-edition/Preview.tsx
+++ b/src/components/ai-edition/Preview.tsx
@@ -1,5 +1,5 @@
import { useEffect, useRef, useState } from "react";
-import type { ZoomFocus } from "@/components/video-editor/types";
+import type { CameraFullscreenRegion, ZoomFocus } from "@/components/video-editor/types";
import type {
AxcutAnnotationRegion,
AxcutClip,
@@ -20,6 +20,7 @@ interface PreviewProps {
clips: AxcutClip[];
zoomRegions?: AxcutZoomRegion[];
speedRegions?: SpeedRegion[];
+ cameraFullscreenRegions?: CameraFullscreenRegion[];
trimRanges?: AxcutTrimRange[];
selectedZoomRegionId?: string | null;
onZoomFocusChange?: (id: string, focus: ZoomFocus) => void;
@@ -51,6 +52,7 @@ export function Preview({
clips,
zoomRegions,
speedRegions,
+ cameraFullscreenRegions,
trimRanges,
selectedZoomRegionId,
onZoomFocusChange,
@@ -98,6 +100,7 @@ export function Preview({
clips={clips}
zoomRegions={zoomRegions}
speedRegions={speedRegions}
+ cameraFullscreenRegions={cameraFullscreenRegions}
trimRanges={trimRanges}
selectedZoomRegionId={selectedZoomRegionId}
onZoomFocusChange={onZoomFocusChange}
diff --git a/src/components/ai-edition/PreviewCanvas.tsx b/src/components/ai-edition/PreviewCanvas.tsx
index 2c9f06074..6c1d5dec2 100644
--- a/src/components/ai-edition/PreviewCanvas.tsx
+++ b/src/components/ai-edition/PreviewCanvas.tsx
@@ -25,12 +25,14 @@
import type { PointerEvent as ReactPointerEvent } from "react";
import { useEffect, useMemo, useRef, useState } from "react";
import {
+ type CameraFullscreenRegion,
type CropRegion,
DEFAULT_CROP_REGION,
type WebcamLayoutPreset,
type WebcamMaskShape,
type ZoomFocus,
} from "@/components/video-editor/types";
+import { computeCameraFullscreenProgress } from "@/components/video-editor/videoPlayback/cameraFullscreenUtils";
import type {
AxcutAnnotationRegion,
AxcutClip,
@@ -44,8 +46,10 @@ import { createPlaybackClockRef } from "@/lib/ai-edition/timeline/playback-clock
import type { SpeedRegion } from "@/lib/ai-edition/timeline/speed";
import { locateVirtualPosition } from "@/lib/ai-edition/timeline/virtual-preview";
import {
+ computeCameraFullscreenTargetRect,
computeCompositeLayout,
getWebcamLayoutCssBoxShadow,
+ lerpRect,
type WebcamCompositeLayout,
} from "@/lib/compositeLayout";
import { classifyWallpaper, resolveImageWallpaperUrl } from "@/lib/wallpaper";
@@ -64,6 +68,7 @@ interface PreviewCanvasProps {
clips: AxcutClip[];
zoomRegions?: AxcutZoomRegion[];
speedRegions?: SpeedRegion[];
+ cameraFullscreenRegions?: CameraFullscreenRegion[];
trimRanges?: AxcutTrimRange[];
selectedZoomRegionId?: string | null;
onZoomFocusChange?: (id: string, focus: ZoomFocus) => void;
@@ -254,6 +259,35 @@ export function PreviewCanvas(props: PreviewCanvasProps) {
settings.padding,
]);
+ // Full Camera: during a cameraFullscreen region the webcam overlay grows to
+ // (almost) fill the canvas and eases back. Mirror the exporter's frameRenderer
+ // exactly — lerp the PiP rect toward computeCameraFullscreenTargetRect (radius
+ // 0 at full) — so preview and export animate to the identical rect.
+ const cameraFullscreenProgress = useMemo(
+ () =>
+ computeCameraFullscreenProgress(
+ props.cameraFullscreenRegions ?? [],
+ Math.round(props.currentTimeSec * 1000),
+ ),
+ [props.cameraFullscreenRegions, props.currentTimeSec],
+ );
+ const effectiveLayout = useMemo<WebcamCompositeLayout | null>(() => {
+ if (!layout?.webcamRect || cameraFullscreenProgress <= 0) return layout;
+ const target = computeCameraFullscreenTargetRect(canvasSize, layout.webcamRect);
+ const fullRect = {
+ x: target.x,
+ y: target.y,
+ width: target.width,
+ height: target.height,
+ borderRadius: 0,
+ maskShape: layout.webcamRect.maskShape,
+ };
+ return {
+ ...layout,
+ webcamRect: lerpRect(layout.webcamRect, fullRect, cameraFullscreenProgress),
+ };
+ }, [layout, cameraFullscreenProgress, canvasSize]);
+
const frameStyle = useMemo(() => buildFrameStyle(settings), [settings]);
const blurStyle = useMemo(() => buildBlurStyle(settings), [settings]);
const screenStyle = useMemo(
@@ -261,8 +295,8 @@ export function PreviewCanvas(props: PreviewCanvasProps) {
[layout, settings, canvasSize],
);
const webcamStyle = useMemo(
- () => buildWebcamStyle(layout, settings, canvasSize),
- [layout, settings, canvasSize],
+ () => buildWebcamStyle(effectiveLayout, settings, canvasSize),
+ [effectiveLayout, settings, canvasSize],
);
// P4 — the layout math above only knows the user's chosen preset
// (PiP/dual/stack), not whether the clip under the playhead actually has a
@@ -428,7 +462,9 @@ export function PreviewCanvas(props: PreviewCanvasProps) {
onTimeChange={props.onTimeChange}
isPlaying={isPlaying}
clockRef={clockRef}
- borderRadius={layout.webcamRect.borderRadius}
+ borderRadius={
+ effectiveLayout?.webcamRect?.borderRadius ?? layout.webcamRect.borderRadius
+ }
webcamMaskShape={settings.webcamMaskShape}
layoutPreset={settings.webcamLayoutPreset}
/>
diff --git a/src/components/ai-edition/RightPanelStack.tsx b/src/components/ai-edition/RightPanelStack.tsx
index ebcdd2219..134e14850 100644
--- a/src/components/ai-edition/RightPanelStack.tsx
+++ b/src/components/ai-edition/RightPanelStack.tsx
@@ -12,6 +12,8 @@ import { useCallback, useEffect, useState } from "react";
import { toast } from "sonner";
import { parseCustomPlaybackSpeedInput } from "@/components/video-editor/customPlaybackSpeed";
import {
+ MAX_NATIVE_PLAYBACK_RATE,
+ MAX_PLAYBACK_SPEED,
MAX_ZOOM_SCALE,
MIN_ZOOM_SCALE,
SPEED_OPTIONS,
@@ -38,7 +40,7 @@ import {
VideoEffectsPane,
} from "./RightPanes";
-type RegionKind = "zoom" | "trim" | "annotation" | "speed";
+type RegionKind = "zoom" | "trim" | "annotation" | "speed" | "cameraFullscreen";
interface RegionHandle {
kind: RegionKind;
@@ -666,7 +668,8 @@ function RegionInspector({
const result = parseCustomPlaybackSpeedInput(speedDraft);
if (result.status === "valid") patchSpeed(result.speed);
else {
- if (result.status === "too-fast") toast.error("Speed can't exceed 16×.");
+ if (result.status === "too-fast")
+ toast.error(`Speed can't exceed ${MAX_PLAYBACK_SPEED}×.`);
setSpeedDraft(
SPEED_OPTIONS.some((o) => o.speed === speedValue) ? "" : String(speedValue),
);
@@ -676,14 +679,39 @@ function RegionInspector({
if (e.key !== "Enter") return;
const result = parseCustomPlaybackSpeedInput(speedDraft);
if (result.status === "valid") patchSpeed(result.speed);
- else if (result.status === "too-fast") toast.error("Speed can't exceed 16×.");
+ else if (result.status === "too-fast")
+ toast.error(`Speed can't exceed ${MAX_PLAYBACK_SPEED}×.`);
e.currentTarget.blur();
}}
style={{ width: "100%" }}
/>
+ {speedValue > MAX_NATIVE_PLAYBACK_RATE ? (
+ <p
+ style={{
+ margin: "6px 0 0",
+ font: "400 10px/1.4 var(--font-sans)",
+ color: "var(--fg-2)",
+ }}
+ >
+ {`Above ${MAX_NATIVE_PLAYBACK_RATE}× the preview plays at ${MAX_NATIVE_PLAYBACK_RATE}×; the export renders the true speed.`}
+ </p>
+ ) : null}
</Field>
</>
) : null}
+ {selection.kind === "cameraFullscreen" ? (
+ <p
+ style={{
+ margin: "0 0 4px",
+ font: "400 12px/1.5 var(--font-sans)",
+ color: "var(--fg-2)",
+ }}
+ >
+ While this region plays, the webcam grows to (almost) fill the frame and eases back at
+ the end. Drag the region's edges on the timeline to change when it starts and how long
+ it lasts.
+ </p>
+ ) : null}
<button
type="button"
onClick={() => onRemove(selection.kind, selection.id)}
@@ -721,6 +749,8 @@ function kindLabel(kind: RegionKind): string {
return "Annotation";
case "speed":
return "Speed region";
+ case "cameraFullscreen":
+ return "Full Camera";
}
}
diff --git a/src/components/ai-edition/RightPanes.tsx b/src/components/ai-edition/RightPanes.tsx
index 1c37dc55a..e82893463 100644
--- a/src/components/ai-edition/RightPanes.tsx
+++ b/src/components/ai-edition/RightPanes.tsx
@@ -30,6 +30,7 @@ import {
useState,
} from "react";
import defaultCursorPreviewUrl from "@/assets/cursors/Cursor=Default.svg";
+import GradientEditor, { type GradientEditorState } from "@/components/ui/gradient-editor";
import type {
AxcutAsset,
AxcutClip,
@@ -52,6 +53,7 @@ import { formatMs } from "@/lib/ai-edition/timeline/format";
import { locateVirtualPosition } from "@/lib/ai-edition/timeline/virtual-preview";
import { getAssetPath } from "@/lib/assetPath";
import { CURSOR_THEMES, DEFAULT_CURSOR_THEME_ID } from "@/lib/cursor/cursorThemes";
+import { buildGradientFromEditor } from "@/lib/gradientBuilder";
import { resolveImageWallpaperUrl, WALLPAPER_PATHS } from "@/lib/wallpaper";
import styles from "./NewEditorShell.module.css";
@@ -170,11 +172,37 @@ const IMAGE_ACCEPT = ".jpg,.jpeg,.png,image/jpeg,image/png";
// paths are restricted to `/wallpapers/...` or the user's own data: URLs from
// the upload custom flow.
export function BackgroundPane() {
- const { settings, set, hasDocument } = useEditorSettings();
+ const { settings, set, setLive, commit, hasDocument } = useEditorSettings();
const [tab, setTab] = useState<"image" | "color" | "gradient">("image");
const fileInputRef = useRef<HTMLInputElement | null>(null);
const customUrls = useMemoCustomWallpapers(settings.wallpaper);
+ // The custom gradient editor emits continuously while the user drags a
+ // color point / angle knob / brightness slider, so mirror the SliderCell
+ // model: preview live with setLive, then persist once the changes settle.
+ const gradientCommitTimer = useRef<number | null>(null);
+ const handleGradientChange = useCallback(
+ (state: GradientEditorState) => {
+ setLive({ wallpaper: buildGradientFromEditor(state) });
+ if (gradientCommitTimer.current !== null) {
+ window.clearTimeout(gradientCommitTimer.current);
+ }
+ gradientCommitTimer.current = window.setTimeout(() => {
+ gradientCommitTimer.current = null;
+ void commit();
+ }, 400);
+ },
+ [setLive, commit],
+ );
+ useEffect(
+ () => () => {
+ if (gradientCommitTimer.current !== null) {
+ window.clearTimeout(gradientCommitTimer.current);
+ }
+ },
+ [],
+ );
+
const isSelected = (value: string) => settings.wallpaper === value;
const handleTabChange = (next: "image" | "color" | "gradient") => {
@@ -282,19 +310,22 @@ export function BackgroundPane() {
onPick={(color) => void set({ wallpaper: color })}
/>
) : (
- <div className={styles.bgGrid}>
- {GRAD_PRESETS.map((bg, i) => (
- <button
- type="button"
- key={bg}
- className={`${styles.bgThumb} ${isSelected(bg) ? styles.isActive : ""}`}
- style={{ background: bg }}
- aria-label={`Gradient ${i + 1}`}
- disabled={!hasDocument}
- onClick={() => void set({ wallpaper: bg })}
- />
- ))}
- </div>
+ <>
+ <div className={styles.bgGrid}>
+ {GRAD_PRESETS.map((bg, i) => (
+ <button
+ type="button"
+ key={bg}
+ className={`${styles.bgThumb} ${isSelected(bg) ? styles.isActive : ""}`}
+ style={{ background: bg }}
+ aria-label={`Gradient ${i + 1}`}
+ disabled={!hasDocument}
+ onClick={() => void set({ wallpaper: bg })}
+ />
+ ))}
+ </div>
+ {hasDocument ? <GradientEditor onChange={handleGradientChange} /> : null}
+ </>
)}
</Pane>
);
diff --git a/src/components/ai-edition/VirtualPreview.tsx b/src/components/ai-edition/VirtualPreview.tsx
index 11d6be942..7102b9252 100644
--- a/src/components/ai-edition/VirtualPreview.tsx
+++ b/src/components/ai-edition/VirtualPreview.tsx
@@ -1,6 +1,10 @@
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
import { fromFileUrl } from "@/components/video-editor/projectPersistence";
-import { type CropRegion, DEFAULT_CROP_REGION } from "@/components/video-editor/types";
+import {
+ type CropRegion,
+ DEFAULT_CROP_REGION,
+ MAX_NATIVE_PLAYBACK_RATE,
+} from "@/components/video-editor/types";
import type { AxcutClip, AxcutTrimRange, AxcutZoomRegion } from "@/lib/ai-edition/schema";
import { useEditorSettings } from "@/lib/ai-edition/store/useEditorSettings";
import type { PlaybackClockRef } from "@/lib/ai-edition/timeline/playback-clock";
@@ -293,7 +297,9 @@ export function VirtualPreview({
speedRegionsRef.current,
Math.round(nextTimeSec * 1000),
);
- const rate = activeRegion?.speed ?? 1;
+ // Clamp to the browser's 16× playbackRate ceiling; >16× is rendered at
+ // its true speed only on the offline export path, not the live preview.
+ const rate = Math.min(activeRegion?.speed ?? 1, MAX_NATIVE_PLAYBACK_RATE);
if (v.playbackRate !== rate) v.playbackRate = rate;
}
},
diff --git a/src/components/ai-edition/preview-compositor/PreviewCompositor.tsx b/src/components/ai-edition/preview-compositor/PreviewCompositor.tsx
index 5727f159d..23d346980 100644
--- a/src/components/ai-edition/preview-compositor/PreviewCompositor.tsx
+++ b/src/components/ai-edition/preview-compositor/PreviewCompositor.tsx
@@ -23,6 +23,7 @@
import { Application, Container, Graphics, Sprite, Texture, VideoSource } from "pixi.js";
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
import { fromFileUrl } from "@/components/video-editor/projectPersistence";
+import { MAX_NATIVE_PLAYBACK_RATE } from "@/components/video-editor/types";
import type { AxcutClip, AxcutTrimRange, AxcutZoomRegion } from "@/lib/ai-edition/schema";
import { useEditorSettings } from "@/lib/ai-edition/store/useEditorSettings";
import type { PlaybackClockRef } from "@/lib/ai-edition/timeline/playback-clock";
@@ -126,7 +127,12 @@ export function PreviewCompositor({
speedRegionsRef.current,
Math.round(nextTimeSec * 1000),
);
- const rate = activeRegion?.speed ?? 1;
+ // Chromium hard-caps HTMLMediaElement.playbackRate at 16×; above that the
+ // element can't actually play faster and the shared clock (below) would
+ // desync from the real frame advance. Clamp the live preview to the native
+ // ceiling — the export path renders the true speed offline (WSOLA audio +
+ // offline frame retiming, gated on MAX_NATIVE_PLAYBACK_RATE).
+ const rate = Math.min(activeRegion?.speed ?? 1, MAX_NATIVE_PLAYBACK_RATE);
if (v.playbackRate !== rate) v.playbackRate = rate;
}
},
diff --git a/src/components/ai-edition/v4/EditorShellV4.module.css b/src/components/ai-edition/v4/EditorShellV4.module.css
index 3955b2777..bd02e784d 100644
--- a/src/components/ai-edition/v4/EditorShellV4.module.css
+++ b/src/components/ai-edition/v4/EditorShellV4.module.css
@@ -1161,6 +1161,10 @@
border-color: var(--accent);
background: var(--accent-soft);
}
+.laneCameraFullscreen {
+ border-color: #a855f7;
+ background: rgba(168, 85, 247, 0.14);
+}
.tlClips {
position: relative;
display: flex;
diff --git a/src/components/ai-edition/v4/FloatingInspector.tsx b/src/components/ai-edition/v4/FloatingInspector.tsx
index 1c2450ea5..de5cf856d 100644
--- a/src/components/ai-edition/v4/FloatingInspector.tsx
+++ b/src/components/ai-edition/v4/FloatingInspector.tsx
@@ -4,6 +4,7 @@ import {
FileText,
Image as ImageIcon,
Layout as LayoutIcon,
+ Maximize2,
MousePointer2,
Pencil,
Scissors,
@@ -451,6 +452,27 @@ function SelectionPane({ tl, onClose }: { tl: TimelineApi; onClose: () => void }
);
}
+ if (selection.kind === "cameraFullscreen") {
+ const region = tl.cameraFullscreenRegions.find((c) => c.id === selection.id);
+ if (!region) return null;
+ return (
+ <div style={{ display: "flex", flexDirection: "column", minHeight: 0 }}>
+ {paneHeader(<Maximize2 size={15} />, "Full Camera", onClose, tc("actions.close"))}
+ <div style={bodyStyle}>
+ <p style={{ margin: 0, fontSize: 12, lineHeight: 1.5, color: "var(--muted)" }}>
+ While this region plays, the webcam grows to (almost) fill the frame and eases back at
+ the end. Drag the region's edges on the timeline to change when it starts and how long
+ it lasts.
+ </p>
+ <button type="button" onClick={deleteAndClose} style={deleteBtnStyle}>
+ <Trash2 size={14} />
+ Delete region
+ </button>
+ </div>
+ </div>
+ );
+ }
+
// trim — a trim ventilated across a clip boundary is 2+ DSL rows that render
// as one coalesced pill (see V4Timeline's trimPills); the inspector must
// resolve the clicked id back to its whole group so the shown duration and
diff --git a/src/components/ai-edition/v4/V4Timeline.tsx b/src/components/ai-edition/v4/V4Timeline.tsx
index bb67a5b40..9df1cc6ab 100644
--- a/src/components/ai-edition/v4/V4Timeline.tsx
+++ b/src/components/ai-edition/v4/V4Timeline.tsx
@@ -2,6 +2,7 @@ import {
ChevronDown,
Clock,
Loader2,
+ Maximize2,
MessageSquare,
Pencil,
Scissors,
@@ -139,7 +140,7 @@ function ClipWaveform({
interface LanePill {
id: string;
- kind: "annotation" | "speed" | "trim" | "zoom";
+ kind: "annotation" | "speed" | "trim" | "zoom" | "cameraFullscreen";
start: number;
end: number;
label: string;
@@ -246,6 +247,14 @@ export function V4Timeline({
label: `${(s as { speed?: number }).speed ?? 1.5}×`,
sourceIds: [s.id],
}));
+ const cameraFullscreenPills: LanePill[] = tl.cameraFullscreenRegions.map((c) => ({
+ id: c.id,
+ kind: "cameraFullscreen",
+ start: c.startMs / 1000,
+ end: c.endMs / 1000,
+ label: "Full Camera",
+ sourceIds: [c.id],
+ }));
const zoomPills: LanePill[] = tl.zoomRegions.map((z) => ({
id: z.id,
kind: "zoom",
@@ -374,6 +383,8 @@ export function V4Timeline({
else if (pill.kind === "speed") void tl.updateSpeedSpan(pill.id, s * 1000, en * 1000);
else if (pill.kind === "annotation")
void tl.updateAnnotationSpan(pill.id, s * 1000, en * 1000);
+ else if (pill.kind === "cameraFullscreen")
+ void tl.updateCameraFullscreenSpan(pill.id, s * 1000, en * 1000);
else {
// Trims are stored in source-time per asset but manipulated on the
// timeline like every other pill. Ventilate the new span across the
@@ -503,7 +514,9 @@ export function V4Timeline({
? styles.laneSpeed
: kind === "trim"
? styles.laneTrim
- : styles.laneZoom;
+ : kind === "cameraFullscreen"
+ ? styles.laneCameraFullscreen
+ : styles.laneZoom;
const pillIcon = (kind: LanePill["kind"]) =>
kind === "annotation" ? (
<MessageSquare size={11} />
@@ -511,6 +524,8 @@ export function V4Timeline({
<Clock size={11} />
) : kind === "trim" ? (
<Scissors size={11} />
+ ) : kind === "cameraFullscreen" ? (
+ <Maximize2 size={11} />
) : (
<ZoomIn size={11} />
);
@@ -895,6 +910,15 @@ export function V4Timeline({
>
<ZoomIn size={15} />
</button>
+ <button
+ type="button"
+ className={styles.tlToolBtn}
+ title="Full Camera"
+ aria-label="Full Camera"
+ onClick={() => void tl.addCameraFullscreen()}
+ >
+ <Maximize2 size={15} />
+ </button>
<span className={styles.tlToolSep} aria-hidden />
<Popover open={aspectMenuOpen} onOpenChange={setAspectMenuOpen}>
<PopoverTrigger asChild>
@@ -1003,6 +1027,7 @@ export function V4Timeline({
</div>
<div className={styles.tlLane}>{renderPills(trimPills, t("toolbar.noTrims"))}</div>
<div className={styles.tlLane}>{renderPills(zoomPills, "")}</div>
+ <div className={styles.tlLane}>{renderPills(cameraFullscreenPills, "")}</div>
</>
) : null}
diff --git a/src/lib/ai-edition/document/timeline.ts b/src/lib/ai-edition/document/timeline.ts
index d63c31847..4656c267a 100644
--- a/src/lib/ai-edition/document/timeline.ts
+++ b/src/lib/ai-edition/document/timeline.ts
@@ -218,6 +218,9 @@ export function moveClip(
const speedRegions = legacy?.speedRegions as
| Array<{ id: string; startMs: number; endMs: number }>
| undefined;
+ const cameraFullscreenRegions = legacy?.cameraFullscreenRegions as
+ | Array<{ id: string; startMs: number; endMs: number }>
+ | undefined;
return {
...document,
zoomRanges: reprojectRegionsForReorder(document.zoomRanges, oldClips, newClips, () =>
@@ -226,14 +229,29 @@ export function moveClip(
annotations: reprojectRegionsForReorder(document.annotations, oldClips, newClips, () =>
createId("ann"),
) as AxcutDocument["annotations"],
- legacyEditor: speedRegions
- ? {
- ...legacy,
- speedRegions: reprojectRegionsForReorder(speedRegions, oldClips, newClips, () =>
- createId("speed"),
- ),
- }
- : document.legacyEditor,
+ legacyEditor:
+ legacy && (speedRegions || cameraFullscreenRegions)
+ ? {
+ ...legacy,
+ ...(speedRegions
+ ? {
+ speedRegions: reprojectRegionsForReorder(speedRegions, oldClips, newClips, () =>
+ createId("speed"),
+ ),
+ }
+ : {}),
+ ...(cameraFullscreenRegions
+ ? {
+ cameraFullscreenRegions: reprojectRegionsForReorder(
+ cameraFullscreenRegions,
+ oldClips,
+ newClips,
+ () => createId("camfull"),
+ ),
+ }
+ : {}),
+ }
+ : document.legacyEditor,
timeline: {
...document.timeline,
clips: newClips,
diff --git a/src/lib/ai-edition/exporter/documentExporter.ts b/src/lib/ai-edition/exporter/documentExporter.ts
index 13fb594a2..c4cdc5fbd 100644
--- a/src/lib/ai-edition/exporter/documentExporter.ts
+++ b/src/lib/ai-edition/exporter/documentExporter.ts
@@ -16,6 +16,7 @@
import { toFileUrl } from "@/components/video-editor/projectPersistence";
import {
type AnnotationRegion,
+ type CameraFullscreenRegion,
type CropRegion,
type SpeedRegion,
type TrimRegion,
@@ -213,6 +214,11 @@ export async function exportAxcutDocument(
clips,
() => createId("speed"),
);
+ const cameraFullscreenRegions: CameraFullscreenRegion[] = projectRegionsToSourceTime(
+ extractLegacyField<CameraFullscreenRegion[]>(legacy, "cameraFullscreenRegions", []),
+ clips,
+ () => createId("camfull"),
+ );
const sourceWidth = options.sourceWidth || 1920;
const sourceHeight = options.sourceHeight || 1080;
@@ -246,6 +252,7 @@ export async function exportAxcutDocument(
zoomRegions,
trimRegions,
speedRegions,
+ cameraFullscreenRegions,
showShadow: shadowIntensity > 0,
shadowIntensity,
showBlur,
diff --git a/src/lib/ai-edition/store/regionClipboard.ts b/src/lib/ai-edition/store/regionClipboard.ts
index f9130aefa..96758f658 100644
--- a/src/lib/ai-edition/store/regionClipboard.ts
+++ b/src/lib/ai-edition/store/regionClipboard.ts
@@ -9,7 +9,8 @@ import { useCallback, useEffect, useState } from "react";
export type RegionSnapshot =
| { kind: "zoom"; region: Record<string, unknown> }
| { kind: "annotation"; region: Record<string, unknown> }
- | { kind: "speed"; region: Record<string, unknown> };
+ | { kind: "speed"; region: Record<string, unknown> }
+ | { kind: "cameraFullscreen"; region: Record<string, unknown> };
let clipboard: RegionSnapshot | null = null;
const listeners = new Set<() => void>();
diff --git a/src/lib/ai-edition/store/useTimeline.ts b/src/lib/ai-edition/store/useTimeline.ts
index 545d31573..f0254f3ad 100644
--- a/src/lib/ai-edition/store/useTimeline.ts
+++ b/src/lib/ai-edition/store/useTimeline.ts
@@ -18,7 +18,7 @@ import { resolveTimelineSpanToTrim } from "../timeline/trim-mapping";
import type { AutoZoomSuggestion } from "../timeline/zoom-suggestions";
import { useProjectStore } from "./projectStore";
-type RegionKind = "zoom" | "trim" | "annotation" | "speed";
+type RegionKind = "zoom" | "trim" | "annotation" | "speed" | "cameraFullscreen";
// Placeholder duration applied to a freshly-inserted clip whose source asset
// hasn't reported its real duration yet (media drag → drop before the preview
@@ -215,6 +215,30 @@ export function useTimeline() {
await saveDocument(next);
}, [document, currentTimeSec, saveDocument]);
+ // Full Camera: a plain time span (no value) during which the preview/export
+ // grows the webcam overlay to (almost) fill the canvas and eases it back.
+ const addCameraFullscreen = useCallback(async () => {
+ if (!document) return;
+ const timeMs = Math.round(currentTimeSec * 1000);
+ const legacy = (document.legacyEditor as Record<string, unknown>) ?? {};
+ const prev = (legacy.cameraFullscreenRegions as unknown[]) ?? [];
+ const next: AxcutDocument = {
+ ...document,
+ legacyEditor: {
+ ...legacy,
+ cameraFullscreenRegions: [
+ ...prev,
+ {
+ id: createId("camfull"),
+ startMs: timeMs,
+ endMs: timeMs + 2000,
+ },
+ ],
+ },
+ };
+ await saveDocument(next);
+ }, [document, currentTimeSec, saveDocument]);
+
const updateTrimRange = useCallback(
async (trimId: string, startSec: number, endSec: number) => {
if (!document) return;
@@ -430,6 +454,32 @@ export function useTimeline() {
[document, saveDocument],
);
+ const updateCameraFullscreenSpan = useCallback(
+ async (id: string, startMs: number, endMs: number) => {
+ if (!document) return;
+ const clampMs = (n: number) => (Number.isFinite(n) ? Math.max(0, Math.round(n)) : 0);
+ const s = clampMs(startMs);
+ const e = clampMs(endMs);
+ const legacy = (document.legacyEditor as Record<string, unknown>) ?? {};
+ const prev = ((legacy.cameraFullscreenRegions as unknown[]) ?? []) as Array<{
+ id: string;
+ startMs: number;
+ endMs: number;
+ }>;
+ const next: AxcutDocument = {
+ ...document,
+ legacyEditor: {
+ ...legacy,
+ cameraFullscreenRegions: prev.map((r) =>
+ r.id === id ? { ...r, startMs: Math.min(s, e), endMs: Math.max(s, e) } : r,
+ ),
+ },
+ };
+ await saveDocument(next);
+ },
+ [document, saveDocument],
+ );
+
const updateSpeedValue = useCallback(
async (id: string, speed: number) => {
if (!document) return;
@@ -474,7 +524,7 @@ export function useTimeline() {
...document,
annotations: document.annotations.filter((a) => a.id !== id),
};
- } else {
+ } else if (kind === "speed") {
const legacy = (document.legacyEditor as Record<string, unknown>) ?? {};
const prev = ((legacy.speedRegions as unknown[]) ?? []).filter(
(s) => (s as { id: string }).id !== id,
@@ -483,6 +533,15 @@ export function useTimeline() {
...document,
legacyEditor: { ...legacy, speedRegions: prev },
};
+ } else {
+ const legacy = (document.legacyEditor as Record<string, unknown>) ?? {};
+ const prev = ((legacy.cameraFullscreenRegions as unknown[]) ?? []).filter(
+ (s) => (s as { id: string }).id !== id,
+ );
+ next = {
+ ...document,
+ legacyEditor: { ...legacy, cameraFullscreenRegions: prev },
+ };
}
await saveDocument(next);
if (selection?.id === id) setSelection(null);
@@ -502,10 +561,16 @@ export function useTimeline() {
handles.filter((h) => h.kind === "annotation").map((h) => h.id),
);
const speedIds = new Set(handles.filter((h) => h.kind === "speed").map((h) => h.id));
+ const cameraFullscreenIds = new Set(
+ handles.filter((h) => h.kind === "cameraFullscreen").map((h) => h.id),
+ );
const legacy = (document.legacyEditor as Record<string, unknown>) ?? {};
const prevSpeed = ((legacy.speedRegions as unknown[]) ?? []).filter(
(s) => !speedIds.has((s as { id: string }).id),
);
+ const prevCameraFullscreen = ((legacy.cameraFullscreenRegions as unknown[]) ?? []).filter(
+ (s) => !cameraFullscreenIds.has((s as { id: string }).id),
+ );
const next: AxcutDocument = {
...document,
zoomRanges: document.zoomRanges.filter(
@@ -517,7 +582,9 @@ export function useTimeline() {
trimRanges: document.timeline.trimRanges.filter((s) => !trimIds.has(s.id)),
},
legacyEditor:
- speedIds.size > 0 ? { ...legacy, speedRegions: prevSpeed } : document.legacyEditor,
+ speedIds.size > 0 || cameraFullscreenIds.size > 0
+ ? { ...legacy, speedRegions: prevSpeed, cameraFullscreenRegions: prevCameraFullscreen }
+ : document.legacyEditor,
};
await saveDocument(next);
setSelection(null);
@@ -918,11 +985,21 @@ export function useTimeline() {
}>) ?? [])
: [];
+ const cameraFullscreenRegions = hasDoc
+ ? (((document.legacyEditor as Record<string, unknown> | null)
+ ?.cameraFullscreenRegions as Array<{
+ id: string;
+ startMs: number;
+ endMs: number;
+ }>) ?? [])
+ : [];
+
return {
zoomRegions: document?.zoomRanges ?? [],
trimRanges: document?.timeline.trimRanges ?? [],
annotationRegions: (document?.annotations ?? []) as unknown as AnnotationRegion[],
speedRegions,
+ cameraFullscreenRegions,
clips: document?.timeline.clips ?? [],
assets: document?.assets ?? [],
hasDoc,
@@ -935,6 +1012,7 @@ export function useTimeline() {
addTrimAt,
addAnnotation,
addSpeed,
+ addCameraFullscreen,
removeRegion,
removeRegions,
selectRegion,
@@ -963,6 +1041,7 @@ export function useTimeline() {
commitAnnotationChange,
updateSpeedSpan,
updateSpeedValue,
+ updateCameraFullscreenSpan,
// T19 — drives the preview video during trim-edge resize.
setCurrentTime: useProjectStore((s) => s.setCurrentTime),
};
diff --git a/src/lib/shortcuts.ts b/src/lib/shortcuts.ts
index 8bd536f91..65b64219e 100644
--- a/src/lib/shortcuts.ts
+++ b/src/lib/shortcuts.ts
@@ -3,6 +3,7 @@ export const SHORTCUT_ACTIONS = [
"addZoom",
"addTrim",
"addSpeed",
+ "addCameraFullscreen",
"addAnnotation",
"addBlur",
"deleteSelected",
@@ -111,6 +112,7 @@ export const DEFAULT_SHORTCUTS: ShortcutsConfig = {
addZoom: { key: "z" },
addTrim: { key: "t" },
addSpeed: { key: "s" },
+ addCameraFullscreen: { key: "c" },
addAnnotation: { key: "a" },
addBlur: { key: "b" },
deleteSelected: { key: "d", ctrl: true },
@@ -124,6 +126,7 @@ export const SHORTCUT_LABELS: Record<ShortcutAction, string> = {
addZoom: "Add Zoom",
addTrim: "Add Trim",
addSpeed: "Add Speed",
+ addCameraFullscreen: "Add Full Camera",
addAnnotation: "Add Annotation",
addBlur: "Add Blur",
deleteSelected: "Delete Selected",