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
fix(preview): fit the video to its container, with inspector-aware padding
Etienne Lescot42a30365ecd7
diff --git a/src/components/ai-edition/NewEditorShell.tsx b/src/components/ai-edition/NewEditorShell.tsxindex 8f790a1d6..43f01934a 100644--- a/src/components/ai-edition/NewEditorShell.tsx+++ b/src/components/ai-edition/NewEditorShell.tsx@@ -1000,7 +1000,20 @@ export function NewEditorShell() {<section className={v4.stage} aria-label="Preview stage">{mode === "edit" ? (<>- <div style={{ position: "absolute", inset: 0 }}>+ <div+ style={{+ position: "absolute",+ inset: 0,+ // ponytail: matches the design's stageWrapStyle+ // (`padding: 40px {inspectorOpen?'360px':'96px'} 110px 80px`)+ // — reserves room for the floating inspector on the+ // right (and transport at the bottom) so the video+ // resizes into the remaining space instead of sitting+ // underneath the panel.+ padding: `40px ${inspectorOpen ? 360 : 96}px 110px 80px`,+ boxSizing: "border-box",+ }}+ ><PreviewhasProject={hasProject}hasAsset={hasAsset}diff --git a/src/components/ai-edition/PreviewCanvas.tsx b/src/components/ai-edition/PreviewCanvas.tsxindex 4ecf04569..58b930d73 100644--- a/src/components/ai-edition/PreviewCanvas.tsx+++ b/src/components/ai-edition/PreviewCanvas.tsx@@ -109,11 +109,21 @@ export function PreviewCanvas(props: PreviewCanvasProps) {useEffect(() => {const el = frameRef.current?.parentElement;if (!el) return;- const update = () =>+ // ponytail: clientWidth/clientHeight include the container's padding+ // (.previewCanvas has var(--sp-5) on all sides). Sizing the frame to+ // that full padded box, then centering it in the smaller content-box+ // grid track, pushed it past the padding edge on every axis —+ // overflow:hidden then clipped the video instead of letting it fit.+ // Subtracting the computed padding gives the actual content box.+ const update = () => {+ const cs = getComputedStyle(el);+ const paddingX = Number.parseFloat(cs.paddingLeft) + Number.parseFloat(cs.paddingRight);+ const paddingY = Number.parseFloat(cs.paddingTop) + Number.parseFloat(cs.paddingBottom);setContainerSize({- width: el.clientWidth || 1280,- height: el.clientHeight || 720,+ width: (el.clientWidth || 1280) - (Number.isFinite(paddingX) ? paddingX : 0),+ height: (el.clientHeight || 720) - (Number.isFinite(paddingY) ? paddingY : 0),});+ };update();if (typeof ResizeObserver === "undefined") return;const observer = new ResizeObserver(update);diff --git a/src/components/ai-edition/v4/V4Timeline.tsx b/src/components/ai-edition/v4/V4Timeline.tsxindex 70f18729a..7ac66c451 100644--- a/src/components/ai-edition/v4/V4Timeline.tsx+++ b/src/components/ai-edition/v4/V4Timeline.tsx@@ -17,10 +17,11 @@ import {useRef,useState,} from "react";+import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover";import type { AxcutClip } from "@/lib/ai-edition/schema";import { useEditorSettings } from "@/lib/ai-edition/store/useEditorSettings";import type { useTimeline } from "@/lib/ai-edition/store/useTimeline";-import { ASPECT_RATIOS, type AspectRatio } from "@/utils/aspectRatioUtils";+import { ASPECT_RATIOS } from "@/utils/aspectRatioUtils";import { EditClipModal } from "../Modals";import type { VideoSource } from "../VirtualPreview";import styles from "./EditorShellV4.module.css";@@ -115,10 +116,7 @@ export function V4Timeline({window.addEventListener("keydown", onKey);return () => window.removeEventListener("keydown", onKey);}, [placingSkip]);- const cycleAspect = () => {- const i = ASPECT_RATIOS.indexOf(settings.aspectRatio as AspectRatio);- void setSettings({ aspectRatio: ASPECT_RATIOS[(i + 1) % ASPECT_RATIOS.length] });- };+ const [aspectMenuOpen, setAspectMenuOpen] = useState(false);const clips = tl.clips;const total = useMemo(@@ -417,16 +415,46 @@ export function V4Timeline({<ZoomIn size={15} /></button><span className={styles.tlToolSep} aria-hidden />- <button- type="button"- className={styles.tlAspect}- title="Cycle aspect ratio"- aria-label="Cycle aspect ratio"- onClick={cycleAspect}- >- {settings.aspectRatio}- <ChevronDown size={10} />- </button>+ <Popover open={aspectMenuOpen} onOpenChange={setAspectMenuOpen}>+ <PopoverTrigger asChild>+ <button+ type="button"+ className={styles.tlAspect}+ title="Aspect ratio"+ aria-label="Aspect ratio"+ >+ {settings.aspectRatio}+ <ChevronDown size={10} />+ </button>+ </PopoverTrigger>+ <PopoverContent+ align="end"+ sideOffset={6}+ animated={false}+ className="w-auto border-0 bg-transparent p-0 shadow-none"+ >+ <div+ className={styles.recMenu}+ style={{ position: "relative", bottom: "auto", width: 150 }}+ >+ {ASPECT_RATIOS.map((ratio) => (+ <button+ type="button"+ key={ratio}+ className={`${styles.recMenuRow}${+ ratio === settings.aspectRatio ? ` ${styles.active}` : ""+ }`}+ onClick={() => {+ void setSettings({ aspectRatio: ratio });+ setAspectMenuOpen(false);+ }}+ >+ {ratio}+ </button>+ ))}+ </div>+ </PopoverContent>+ </Popover></div>) : (<div style={{ display: "flex", flexDirection: "column", gap: 2 }}>