Skip to content

Open source CapCut alternative.

TypeScript

feat(site): mirror a video clip's picture [rebuild]

David Le9c0a953e2f39
diff --git a/site/src/cut/components/Inspector.tools.ts b/site/src/cut/components/Inspector.tools.ts
index 4be9dc8f..a35d4e2f 100644
--- a/site/src/cut/components/Inspector.tools.ts
+++ b/site/src/cut/components/Inspector.tools.ts
@@ -254,14 +254,16 @@ export const INSPECTOR_TOOLS = [
{
name: "set_framing",
description:
- "Set how a video clip meets its box (the project frame, or its region): 'fit' letterboxes the whole picture (default), 'fill' scales it to cover the box and crops the overflow. zoom pushes further in from there, 1..4. Whenever the picture overflows, panX/panY (-1..1, 0=centered) choose what stays visible — e.g. panY=-1 keeps the top. Landscape footage in a vertical project usually wants fill plus a pan that holds the subject.",
+ "Set how a video clip meets its box (the project frame, or its region): 'fit' letterboxes the whole picture (default), 'fill' scales it to cover the box and crops the overflow. zoom pushes further in from there, 1..4. Whenever the picture overflows, panX/panY (-1..1, 0=centered) choose what stays visible — e.g. panY=-1 keeps the top. flipH mirrors the picture left for right (a front-camera take that reads backward, text and all, wants flipH true), flipV top for bottom. Only the fields you pass change; the rest of the clip's framing stays. Landscape footage in a vertical project usually wants fill plus a pan that holds the subject.",
inputSchema: obj({
clipId: str("Video clip id"),
mode: { type: "string", enum: ["fit", "fill"], description: "Framing mode" },
zoom: num("Zoom past the fitted size, 1 (none) .. 4"),
panX: num("Crop pan -1 (left) .. 1 (right), when the picture overflows"),
panY: num("Crop pan -1 (top) .. 1 (bottom), when the picture overflows"),
- }, ["clipId", "mode"]),
+ flipH: bool("Mirror the picture horizontally"),
+ flipV: bool("Mirror the picture vertically"),
+ }, ["clipId"]),
},
{
name: "set_clip_style",
diff --git a/site/src/cut/components/Inspector.tsx b/site/src/cut/components/Inspector.tsx
index addf9bb5..509e47fe 100644
--- a/site/src/cut/components/Inspector.tsx
+++ b/site/src/cut/components/Inspector.tsx
@@ -2,7 +2,7 @@
import { useQueryClient } from "@tanstack/react-query";
import { useCallback, useEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
-import { AlignCenter, AlignHorizontalSpaceAround, AlignLeft, AlignRight, AlignVerticalSpaceAround, Bold, ChevronLeft, ChevronRight, Diamond, Frame, House, Italic, Link2, Link2Off, Loader2, type LucideIcon, Palette, PanelRightClose, PanelRightOpen, PenTool, Scissors, Smile, Sparkles, Trash2, Type, User, Volume2 } from "lucide-react";
+import { AlignCenter, AlignHorizontalSpaceAround, AlignLeft, AlignRight, AlignVerticalSpaceAround, Bold, ChevronLeft, ChevronRight, Diamond, FlipHorizontal2, FlipVertical2, Frame, House, Italic, Link2, Link2Off, Loader2, type LucideIcon, Palette, PanelRightClose, PanelRightOpen, PenTool, Scissors, Smile, Sparkles, Trash2, Type, User, Volume2 } from "lucide-react";
import { Button } from "@/components/ui/button";
import { EmojiPicker } from "@/cut/components/EmojiPicker";
import { FontPicker } from "@/cut/components/FontPicker";
@@ -22,6 +22,7 @@ import {
} from "@/components/ui/dialog";
import { Input } from "@/components/ui/input";
import { Switch } from "@/components/ui/switch";
+import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip";
import { Textarea } from "@/components/ui/textarea";
import {
EFFECT_LABELS,
@@ -1328,6 +1329,35 @@ function ClipPanel({ clip }: { clip: VideoClip }) {
onClick={() => updateClip(clip.id, { rotation: undefined })}
/>
</Row>
+ <Row label="Flip">
+ <div className="clip-flip flex rounded-lg border border-input p-0.5">
+ {(
+ [
+ ["flipH", "Flip horizontal", FlipHorizontal2],
+ ["flipV", "Flip vertical", FlipVertical2],
+ ] as const
+ ).map(([key, label, Icon]) => (
+ <TooltipProvider key={key}>
+ <Tooltip>
+ <TooltipTrigger
+ aria-label={label}
+ aria-pressed={!!clip[key]}
+ className={cn(
+ "grid size-6 place-items-center rounded-md transition-colors",
+ clip[key]
+ ? "bg-neutral-900 text-white"
+ : "text-muted-foreground hover:text-foreground"
+ )}
+ onClick={() => updateClip(clip.id, { [key]: clip[key] ? undefined : true })}
+ >
+ <Icon className="size-3.5" />
+ </TooltipTrigger>
+ <TooltipContent side="bottom">{label}</TooltipContent>
+ </Tooltip>
+ </TooltipProvider>
+ ))}
+ </div>
+ </Row>
<Row label="Opacity">
<ValueSlider
label="Opacity"
diff --git a/site/src/cut/components/Preview.tsx b/site/src/cut/components/Preview.tsx
index 8e065be9..c1bc84a0 100644
--- a/site/src/cut/components/Preview.tsx
+++ b/site/src/cut/components/Preview.tsx
@@ -928,7 +928,7 @@ function ClipTransformGizmo({ stage }: { stage: Stage }) {
// compositor draws and the export crops, measured in stage pixels so the two
// axes share one scale.
const boxPx = { x: r.x * stage.w, y: r.y * stage.h, w: r.w * stage.w, h: r.h * stage.h };
- const pic =
+ const framed =
asset?.width && asset?.height
? contentRect(
boxPx,
@@ -940,6 +940,13 @@ function ClipTransformGizmo({ stage }: { stage: Stage }) {
clip.panY ?? 0
)
: boxPx;
+ // A mirrored picture lands on the other side of the box center, so the
+ // outline sits where the pixels are.
+ const pic = {
+ ...framed,
+ x: clip.flipH ? 2 * (boxPx.x + boxPx.w / 2) - (framed.x + framed.w) : framed.x,
+ y: clip.flipV ? 2 * (boxPx.y + boxPx.h / 2) - (framed.y + framed.h) : framed.y,
+ };
const ox = Math.max(0, pic.w - boxPx.w);
const oy = Math.max(0, pic.h - boxPx.h);
const overflows = ox > 1 || oy > 1;
@@ -1138,7 +1145,11 @@ function ClipTransformGizmo({ stage }: { stage: Stage }) {
surfaceDrag(
e,
(rawX, rawY) => {
- const { dx, dy } = unturn(rawX, rawY);
+ const { dx: tx, dy: ty } = unturn(rawX, rawY);
+ // Content follows the pointer on screen; a mirrored axis runs the
+ // crop window the other way through the source.
+ const dx = clip.flipH ? -tx : tx;
+ const dy = clip.flipV ? -ty : ty;
const vx = ox > 1 ? Math.max(-1, Math.min(1, panX0 - dx / (ox / 2))) : 0;
const vy = oy > 1 ? Math.max(-1, Math.min(1, panY0 - dy / (oy / 2))) : 0;
const sx = ox > 1 && Math.abs(vx) * (ox / 2) <= PAN_SNAP_PX;
diff --git a/site/src/cut/components/RemovalBrush.tsx b/site/src/cut/components/RemovalBrush.tsx
index e6f534c3..e6278a9c 100644
--- a/site/src/cut/components/RemovalBrush.tsx
+++ b/site/src/cut/components/RemovalBrush.tsx
@@ -263,10 +263,11 @@ function BrushSurface({
vx /= scl;
vy /= scl;
}
- return {
- x: Math.min(1, Math.max(0, (vx - (pic.x - ax)) / Math.max(1, pic.w))),
- y: Math.min(1, Math.max(0, (vy - (pic.y - ay)) / Math.max(1, pic.h))),
- };
+ // The surface sits where the mirrored picture shows; a mirrored axis
+ // reads the source fraction from the other edge.
+ const fx = Math.min(1, Math.max(0, (vx - (pic.x - ax)) / Math.max(1, pic.w)));
+ const fy = Math.min(1, Math.max(0, (vy - (pic.y - ay)) / Math.max(1, pic.h)));
+ return { x: clip.flipH ? 1 - fx : fx, y: clip.flipV ? 1 - fy : fy };
};
const onPointerDown = (e: React.PointerEvent<HTMLDivElement>) => {
@@ -313,7 +314,7 @@ function BrushSurface({
// surface travels with its picture.
const r = rectOf(clip);
const boxPx = { x: r.x * stage.w, y: r.y * stage.h, w: r.w * stage.w, h: r.h * stage.h };
- const pic = contentRect(
+ const framed = contentRect(
boxPx,
asset.width!,
asset.height!,
@@ -322,6 +323,13 @@ function BrushSurface({
clip.panX ?? 0,
clip.panY ?? 0
);
+ // A mirrored picture lands on the other side of the box center; the
+ // surface follows the pixels, and the selection paints mirrored over them.
+ const pic = {
+ ...framed,
+ x: clip.flipH ? 2 * (boxPx.x + boxPx.w / 2) - (framed.x + framed.w) : framed.x,
+ y: clip.flipV ? 2 * (boxPx.y + boxPx.h / 2) - (framed.y + framed.h) : framed.y,
+ };
const pose = clipKeyed(clip) ? clipPoseAt(clip, tLocal) : null;
const ax = (pose ? pose.x : r.x + r.w / 2) * stage.w;
const ay = (pose ? pose.y : r.y + r.h / 2) * stage.h;
@@ -381,7 +389,16 @@ function BrushSurface({
if (!gesture.current) updatePointer(null);
}}
>
- <canvas ref={overlayRef} className="pointer-events-none absolute inset-0 size-full" />
+ <canvas
+ ref={overlayRef}
+ className="pointer-events-none absolute inset-0 size-full"
+ style={{
+ transform:
+ clip.flipH || clip.flipV
+ ? `scale(${clip.flipH ? -1 : 1}, ${clip.flipV ? -1 : 1})`
+ : undefined,
+ }}
+ />
<div
ref={ringRef}
className="pointer-events-none absolute rounded-full border border-white/90 shadow-[0_0_0_1px_rgba(0,0,0,0.4)]"
diff --git a/site/src/cut/components/Timeline.tools.ts b/site/src/cut/components/Timeline.tools.ts
index 0d7b1971..0fe00fea 100644
--- a/site/src/cut/components/Timeline.tools.ts
+++ b/site/src/cut/components/Timeline.tools.ts
@@ -159,7 +159,7 @@ export const TIMELINE_TOOLS = [
{
name: "update_overlay_video",
description:
- "Update an overlay video clip: move it (start, track), trim (in/out), mute, hide, change its frame region (layout preset, or a custom region rect in frame fractions), fit, or speed.",
+ "Update an overlay video clip: move it (start, track), trim (in/out), mute, hide, change its frame region (layout preset, or a custom region rect in frame fractions), fit, zoom, mirror (flipH/flipV), rotation, opacity, or speed.",
inputSchema: obj({
id: str("Overlay video clip id"),
start: num("Timeline start s"),
@@ -181,6 +181,8 @@ export const TIMELINE_TOOLS = [
}, ["x", "y", "w", "h"]),
fit: { type: "string", enum: ["fit", "fill"], description: "How the video meets its region" },
zoom: num("Zoom the picture past its fitted size, 1 (none) .. 4; the overflow crops"),
+ flipH: bool("Mirror the picture horizontally (left for right)"),
+ flipV: bool("Mirror the picture vertically (top for bottom)"),
rotation: num("Resting turn in degrees clockwise, -180..180 (0 clears)"),
opacity: num("Resting opacity 0..1 (1 clears)"),
speed: num("Playback rate (1 = normal, no upper limit)"),
diff --git a/site/src/cut/lib/aiContext.ts b/site/src/cut/lib/aiContext.ts
index bb108897..3180ef1d 100644
--- a/site/src/cut/lib/aiContext.ts
+++ b/site/src/cut/lib/aiContext.ts
@@ -501,6 +501,8 @@ function describeState(
panY: r(sp.clip.panY ?? 0),
}
: {}),
+ ...(sp.clip.flipH ? { flipH: true } : {}),
+ ...(sp.clip.flipV ? { flipV: true } : {}),
...(sp.clip.rotation ? { rotation: sp.clip.rotation } : {}),
...((sp.clip.opacity ?? 1) < 1 ? { opacity: r(sp.clip.opacity ?? 1) } : {}),
...(sp.clip.grade ? { colorGrade: sp.clip.grade } : {}),
@@ -658,6 +660,8 @@ function describeOverlayClip(c: VideoClip, assets: Map<string, { name: string }>
: c.fit === "fill"
? { panX: r(c.panX ?? 0), panY: r(c.panY ?? 0) }
: {}),
+ ...(c.flipH ? { flipH: true } : {}),
+ ...(c.flipV ? { flipV: true } : {}),
...(c.rotation ? { rotation: c.rotation } : {}),
...((c.opacity ?? 1) < 1 ? { opacity: r(c.opacity ?? 1) } : {}),
...(retimeOf(c).rate !== 1 || c.speedCurve || c.reverse || c.smoothSlow ? describeRate(c) : {}),
diff --git a/site/src/cut/lib/aiTools.ts b/site/src/cut/lib/aiTools.ts
index 7da3f17d..fc68a4f8 100644
--- a/site/src/cut/lib/aiTools.ts
+++ b/site/src/cut/lib/aiTools.ts
@@ -1381,6 +1381,8 @@ const toolRuns: Record<BrowserToolName, ToolRun> = {
const z = clamp(input.zoom, 1, CLIP_MAX_ZOOM);
patch.zoom = z > 1 ? z : undefined;
}
+ if (typeof input.flipH === "boolean") patch.flipH = input.flipH || undefined;
+ if (typeof input.flipV === "boolean") patch.flipV = input.flipV || undefined;
if (isNum(input.rotation)) {
const deg = Math.round(clamp(input.rotation, -180, 180));
patch.rotation = deg === 0 ? undefined : deg;
@@ -1400,6 +1402,8 @@ const toolRuns: Record<BrowserToolName, ToolRun> = {
layout: regionLabel(rectOf(next)),
fit: next.fit ?? "fit",
...(clipZoom(next) > 1 ? { zoom: clipZoom(next) } : {}),
+ ...(next.flipH ? { flipH: true } : {}),
+ ...(next.flipV ? { flipV: true } : {}),
...(next.rotation ? { rotation: next.rotation } : {}),
...((next.opacity ?? 1) < 1 ? { opacity: next.opacity } : {}),
muted: next.muted,
@@ -2218,15 +2222,21 @@ const toolRuns: Record<BrowserToolName, ToolRun> = {
set_framing: (s, input) => {
const clip = requireItem(s.clips, input.clipId, "video clip");
- const mode = input.mode === "fill" ? "fill" : "fit";
- const zoom = isNum(input.zoom) ? clamp(input.zoom, 1, CLIP_MAX_ZOOM) : 1;
+ // Only what the call names changes; the rest of the framing stays as
+ // the user left it.
+ const mode = input.mode === "fill" || input.mode === "fit" ? input.mode : clip.fit ?? "fit";
+ const zoom = isNum(input.zoom) ? clamp(input.zoom, 1, CLIP_MAX_ZOOM) : clipZoom(clip);
// Pan only means something once something overflows the box.
const pannable = mode === "fill" || zoom > 1;
+ const pan = (axis: "panX" | "panY") =>
+ !pannable ? 0 : isNum(input[axis]) ? clamp(input[axis], -1, 1) : clip[axis] ?? 0;
s.updateClip(clip.id, {
fit: mode,
zoom: zoom > 1 ? zoom : undefined,
- panX: pannable && isNum(input.panX) ? clamp(input.panX, -1, 1) : 0,
- panY: pannable && isNum(input.panY) ? clamp(input.panY, -1, 1) : 0,
+ panX: pan("panX"),
+ panY: pan("panY"),
+ ...(typeof input.flipH === "boolean" ? { flipH: input.flipH || undefined } : {}),
+ ...(typeof input.flipV === "boolean" ? { flipV: input.flipV || undefined } : {}),
});
const next = useEditor.getState().clips.find((c) => c.id === clip.id)!;
return {
@@ -2235,6 +2245,8 @@ const toolRuns: Record<BrowserToolName, ToolRun> = {
zoom: clipZoom(next),
panX: next.panX ?? 0,
panY: next.panY ?? 0,
+ flipH: !!next.flipH,
+ flipV: !!next.flipV,
};
},
@@ -2444,6 +2456,8 @@ const toolRuns: Record<BrowserToolName, ToolRun> = {
zoom: clipZoom(span.clip),
panX: span.clip.panX ?? 0,
panY: span.clip.panY ?? 0,
+ flipH: span.clip.flipH,
+ flipV: span.clip.flipV,
}).catch(
(e) => {
throw new ToolError(
@@ -2468,6 +2482,8 @@ const toolRuns: Record<BrowserToolName, ToolRun> = {
zoom: clipZoom(span.clip),
panX: span.clip.panX ?? 0,
panY: span.clip.panY ?? 0,
+ flipH: !!span.clip.flipH,
+ flipV: !!span.clip.flipV,
},
}),
});
diff --git a/site/src/cut/lib/composite.ts b/site/src/cut/lib/composite.ts
index cd03106d..54122b34 100644
--- a/site/src/cut/lib/composite.ts
+++ b/site/src/cut/lib/composite.ts
@@ -802,11 +802,22 @@ export class FrameCompositor {
const rad = Math.max(0, (bs?.radius ?? 0) * ds);
const prevAlpha = ctx.globalAlpha;
ctx.globalAlpha = Math.max(0, Math.min(1, alpha));
- if (fill || dw > rw + 0.5 || dh > rh + 0.5 || rad > 0) {
+ const clipped = fill || dw > rw + 0.5 || dh > rh + 0.5 || rad > 0;
+ const flipped = !!(clip?.flipH || clip?.flipV);
+ if (clipped || flipped) {
ctx.save();
- ctx.beginPath();
- ctx.roundRect(rx, ry, rw, rh, rad);
- ctx.clip();
+ if (clipped) {
+ ctx.beginPath();
+ ctx.roundRect(rx, ry, rw, rh, rad);
+ ctx.clip();
+ }
+ if (flipped) {
+ // The mirror turns about the box center, so the framed picture stays
+ // in its box and the mask and pose passes see it where it was.
+ ctx.translate(rx + rw / 2, ry + rh / 2);
+ ctx.scale(clip?.flipH ? -1 : 1, clip?.flipV ? -1 : 1);
+ ctx.translate(-(rx + rw / 2), -(ry + rh / 2));
+ }
ctx.drawImage(src, dx, dy, dw, dh);
ctx.restore();
} else {
@@ -880,10 +891,10 @@ export class FrameCompositor {
}
// A regioned track-0 clip (split-screen half) draws into its rect over the
// black frame; the full-frame path below keeps the pan-crop behavior. A
- // styled box (rounded corners, border) also routes through the rect path,
- // which knows how to draw the style at full frame too.
+ // styled box (rounded corners, border) or a mirrored picture also routes
+ // through the rect path, which knows how to draw those at full frame too.
const rect = rectOf(clip ?? {});
- if (!isFullRect(rect) || clip?.boxStyle) {
+ if (!isFullRect(rect) || clip?.boxStyle || clip?.flipH || clip?.flipV) {
this.drawIntoRect(frame, rect, !!clip && clipCovers(clip), alpha, at, zoom, clip);
if (hasFx) ctx.restore();
return;
diff --git a/site/src/cut/lib/media.ts b/site/src/cut/lib/media.ts
index 7edcbd67..fdedc4b8 100644
--- a/site/src/cut/lib/media.ts
+++ b/site/src/cut/lib/media.ts
@@ -1173,6 +1173,8 @@ export async function captureFreezeFrame(
zoom?: number;
panX?: number;
panY?: number;
+ flipH?: boolean;
+ flipV?: boolean;
}
): Promise<MediaAsset> {
const frame = await frameAt(sourceUrl, srcTime);
@@ -1198,6 +1200,11 @@ export async function captureFreezeFrame(
ctx.beginPath();
ctx.rect(0, 0, w, h);
ctx.clip();
+ if (framed.flipH || framed.flipV) {
+ ctx.translate(w / 2, h / 2);
+ ctx.scale(framed.flipH ? -1 : 1, framed.flipV ? -1 : 1);
+ ctx.translate(-w / 2, -h / 2);
+ }
ctx.drawImage(frame.canvas as CanvasImageSource, r.x, r.y, r.w, r.h);
ctx.restore();
picture = out;
diff --git a/site/src/cut/lib/store.ts b/site/src/cut/lib/store.ts
index 9ab2d780..238b143a 100644
--- a/site/src/cut/lib/store.ts
+++ b/site/src/cut/lib/store.ts
@@ -97,6 +97,8 @@ const framingOf = (c: VideoClip) => ({
...(c.zoom && c.zoom > 1 ? { zoom: c.zoom } : {}),
...(c.panX ? { panX: c.panX } : {}),
...(c.panY ? { panY: c.panY } : {}),
+ ...(c.flipH ? { flipH: true } : {}),
+ ...(c.flipV ? { flipV: true } : {}),
...(c.rotation ? { rotation: c.rotation } : {}),
...((c.opacity ?? 1) < 1 ? { opacity: c.opacity } : {}),
});
@@ -108,6 +110,8 @@ const templateFraming = (l: TemplateLayer) => ({
...(l.zoom && l.zoom > 1 ? { zoom: l.zoom } : {}),
...(l.panX ? { panX: l.panX } : {}),
...(l.panY ? { panY: l.panY } : {}),
+ ...(l.flipH ? { flipH: true } : {}),
+ ...(l.flipV ? { flipV: true } : {}),
...(l.rotation ? { rotation: l.rotation } : {}),
...((l.opacity ?? 1) < 1 ? { opacity: l.opacity } : {}),
});
diff --git a/site/src/cut/lib/types.ts b/site/src/cut/lib/types.ts
index 7f7111b3..e92ef5d6 100644
--- a/site/src/cut/lib/types.ts
+++ b/site/src/cut/lib/types.ts
@@ -540,6 +540,11 @@ export interface VideoClip {
* box — covering it, zoomed into it, or both. */
panX?: number;
panY?: number;
+ /** Mirrors the framed picture across its box's vertical axis, left for
+ * right: a front-camera take reads the way its viewfinder did. */
+ flipH?: boolean;
+ /** Mirrors the framed picture top for bottom. */
+ flipV?: boolean;
/** Resting turn, degrees clockwise about the box center; absent = upright.
* A pose key track overrides it while it plays. */
rotation?: number;
@@ -1049,10 +1054,13 @@ export interface TemplateLayer {
out: number;
frame?: FrameRect;
fit?: "fit" | "fill";
- /** The picture's own framing inside that box: zoom, crop pan, turn, fade. */
+ /** The picture's own framing inside that box: zoom, crop pan, mirror,
+ * turn, fade. */
zoom?: number;
panX?: number;
panY?: number;
+ flipH?: boolean;
+ flipV?: boolean;
rotation?: number;
opacity?: number;
muted: boolean;
diff --git a/site/src/cut/server/frames.ts b/site/src/cut/server/frames.ts
index 139abd82..a54514a1 100644
--- a/site/src/cut/server/frames.ts
+++ b/site/src/cut/server/frames.ts
@@ -65,6 +65,9 @@ export interface FreezeFraming {
zoom?: number;
panX: number;
panY: number;
+ /** Mirror the framed picture left for right / top for bottom. */
+ flipH?: boolean;
+ flipV?: boolean;
}
/**
@@ -107,10 +110,12 @@ export async function makeFreezeFrame(
const kx = (0.5 + (framing?.panX ?? 0) / 2).toFixed(4);
const ky = (0.5 + (framing?.panY ?? 0) / 2).toFixed(4);
const crop = `,crop=${fexpr(`min(iw,${w})`)}:${fexpr(`min(ih,${h})`)}:(iw-ow)*${kx}:(ih-oh)*${ky}`;
+ const mirror = (framing?.flipH ? ",hflip" : "") + (framing?.flipV ? ",vflip" : "");
vf = cover
- ? `scale=${even(w * z)}:${even(h * z)}:force_original_aspect_ratio=increase${crop}`
+ ? `scale=${even(w * z)}:${even(h * z)}:force_original_aspect_ratio=increase${crop}${mirror}`
: `scale=${even(w * z)}:${even(h * z)}:force_original_aspect_ratio=decrease` +
(z > 1.0001 ? crop : "") +
+ mirror +
`,pad=${w}:${h}:(ow-iw)/2:(oh-ih)/2:black`;
}
diff --git a/site/src/cut/server/http/projects.ts b/site/src/cut/server/http/projects.ts
index bb54415e..4bee6009 100644
--- a/site/src/cut/server/http/projects.ts
+++ b/site/src/cut/server/http/projects.ts
@@ -385,7 +385,14 @@ export const projectsApi = {
srcTime?: number;
duration?: number;
frame?: { w?: number; h?: number };
- framing?: { fit?: "fit" | "fill"; zoom?: number; panX?: number; panY?: number };
+ framing?: {
+ fit?: "fit" | "fill";
+ zoom?: number;
+ panX?: number;
+ panY?: number;
+ flipH?: boolean;
+ flipV?: boolean;
+ };
};
if (!body.file || typeof body.srcTime !== "number") {
return err("file and srcTime are required.", 400);
@@ -400,6 +407,8 @@ export const projectsApi = {
zoom: typeof body.framing?.zoom === "number" ? body.framing.zoom : 1,
panX: typeof body.framing?.panX === "number" ? body.framing.panX : 0,
panY: typeof body.framing?.panY === "number" ? body.framing.panY : 0,
+ flipH: body.framing?.flipH === true,
+ flipV: body.framing?.flipV === true,
}
: undefined;
const made = await makeFreezeFrame(id, body.file, body.srcTime, body.duration ?? 1, frame, framing);