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): Studio Dashboard empty state + project lifecycle
makaradam00191c479ec0
diff --git a/index.html b/index.htmlindex ce1c274aa..510c15ddd 100644--- a/index.html+++ b/index.html@@ -1,12 +1,12 @@<!doctype html>-<html lang="en">+<html lang="en" class="dark"><head><meta charset="UTF-8" /><link rel="icon" type="image/svg+xml" href="/vite.svg" /><meta name="viewport" content="width=device-width, initial-scale=1.0" /><title></title></head>- <body>+ <body style="background:#09090b;margin:0"><div id="root"></div><script type="module" src="/src/main.tsx"></script></body>diff --git a/src/App.tsx b/src/App.tsxindex 6f737b9b0..6c36aa8c5 100644--- a/src/App.tsx+++ b/src/App.tsx@@ -4,6 +4,7 @@ import { LaunchWindow } from "./components/launch/LaunchWindow";import { SourceSelector } from "./components/launch/SourceSelector";import { Toaster } from "./components/ui/sonner";import { TooltipProvider } from "./components/ui/tooltip";+import { useScopedT } from "./contexts/I18nContext";import { ShortcutsProvider } from "./contexts/ShortcutsContext";import { loadAllCustomFonts } from "./lib/customFonts";@@ -18,6 +19,7 @@ export default function App() {const [windowType, setWindowType] = useState(() => new URLSearchParams(window.location.search).get("windowType") || "",);+ const tEditor = useScopedT("editor");useEffect(() => {const type = new URLSearchParams(window.location.search).get("windowType") || "";@@ -64,7 +66,35 @@ export default function App() {case "editor":return (<ShortcutsProvider>- <Suspense fallback={<div className="h-screen bg-background" />}>+ <Suspense+ fallback={+ <div className="flex flex-col items-center justify-center gap-3 h-screen bg-[#09090b]">+ <svg+ className="animate-spin text-[#34B27B]"+ xmlns="http://www.w3.org/2000/svg"+ fill="none"+ viewBox="0 0 24 24"+ width={28}+ height={28}+ >+ <circle+ className="opacity-25"+ cx="12"+ cy="12"+ r="10"+ stroke="currentColor"+ strokeWidth="4"+ />+ <path+ className="opacity-75"+ fill="currentColor"+ d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"+ />+ </svg>+ <span className="text-white/50 text-sm">{tEditor("loadingEditor")}</span>+ </div>+ }+ ><VideoEditor /><ShortcutsConfigDialog /></Suspense>diff --git a/src/components/launch/LaunchWindow.tsx b/src/components/launch/LaunchWindow.tsxindex bea0e0167..bba5f494c 100644--- a/src/components/launch/LaunchWindow.tsx+++ b/src/components/launch/LaunchWindow.tsx@@ -1,4 +1,4 @@-import { Check, ChevronDown, Columns3, Languages, Rows3 } from "lucide-react";+import { Check, ChevronDown, Clapperboard, Columns3, Languages, Rows3 } from "lucide-react";import { useCallback, useEffect, useRef, useState } from "react";import { createPortal } from "react-dom";import { BsPauseCircle, BsPlayCircle, BsRecordCircle } from "react-icons/bs";@@ -344,29 +344,6 @@ export function LaunchWindow() {}};- const openVideoFile = async () => {- const result = await window.electronAPI.openVideoFilePicker();-- if (result.canceled) {- return;- }-- if (result.success && result.path) {- const setVideoPathResult = await nativeBridgeClient.project.setCurrentVideoPath(result.path);- if (!setVideoPathResult.success) {- console.error("Failed to set current video path:", setVideoPathResult);- return;- }- await window.electronAPI.switchToEditor();- }- };-- const openProjectFile = async () => {- const result = await nativeBridgeClient.project.loadProjectFile();- if (result.canceled || !result.success) return;- await window.electronAPI.switchToEditor();- };-const sendHudOverlayHide = () => {if (window.electronAPI && window.electronAPI.hudOverlayHide) {window.electronAPI.hudOverlayHide();@@ -807,29 +784,15 @@ export function LaunchWindow() {)}{!recording && (- <>- {/* Open video file */}- <Tooltip content={t("tooltips.openVideoFile")}>- <button- data-testid="launch-open-video-button"- className={`${hudIconBtnClasses} ${styles.electronNoDrag}`}- onClick={openVideoFile}- >- {getIcon("videoFile", "text-white/60")}- </button>- </Tooltip>-- {/* Open project */}- <Tooltip content={t("tooltips.openProject")}>- <button- data-testid="launch-open-project-button"- className={`${hudIconBtnClasses} ${styles.electronNoDrag}`}- onClick={openProjectFile}- >- {getIcon("folder", "text-white/60")}- </button>- </Tooltip>- </>+ <Tooltip content={t("tooltips.openStudio")}>+ <button+ data-testid="launch-open-studio-button"+ className={`${hudIconBtnClasses} ${styles.electronNoDrag}`}+ onClick={() => window.electronAPI.switchToEditor()}+ >+ <Clapperboard size={ICON_SIZE} className="text-white/60" />+ </button>+ </Tooltip>)}{/* Right sidebar controls */}diff --git a/src/components/video-editor/EditorEmptyState.tsx b/src/components/video-editor/EditorEmptyState.tsxnew file mode 100644index 000000000..511323abe--- /dev/null+++ b/src/components/video-editor/EditorEmptyState.tsx@@ -0,0 +1,202 @@+import { AlertCircle, Film, FolderOpen, Upload, X } from "lucide-react";+import { useCallback, useRef, useState } from "react";+import { Dialog, DialogContent, DialogHeader, DialogTitle } from "@/components/ui/dialog";+import { useScopedT } from "@/contexts/I18nContext";+import { nativeBridgeClient } from "@/native";++interface EditorEmptyStateProps {+ onVideoImported: (videoPath: string) => void;+ /** Called with the loaded project data — handles both button click and drag-drop */+ onProjectOpened: (project: unknown, path: string | null) => void;+}++type DropError = "unsupported-format" | "load-failed" | null;++export function EditorEmptyState({ onVideoImported, onProjectOpened }: EditorEmptyStateProps) {+ const te = useScopedT("editor");+ const tc = useScopedT("common");+ const [isDraggingOver, setIsDraggingOver] = useState(false);+ const [dropError, setDropError] = useState<DropError>(null);+ // Freeze the last non-null error type so dialog content doesn't snap to the+ // else-branch during the closing animation (same pattern as UnsavedChangesDialog).+ const lastDropErrorRef = useRef<Exclude<DropError, null>>("unsupported-format");+ if (dropError !== null) {+ lastDropErrorRef.current = dropError;+ }++ const handleImportVideo = useCallback(async () => {+ const result = await window.electronAPI.openVideoFilePicker();+ if (result.canceled || !result.success || !result.path) return;++ const setResult = await nativeBridgeClient.project.setCurrentVideoPath(result.path);+ if (!setResult.success) return;++ onVideoImported(result.path);+ }, [onVideoImported]);++ const handleLoadProject = useCallback(async () => {+ const result = await nativeBridgeClient.project.loadProjectFile();+ if (result.canceled || !result.success || !result.project) return;+ onProjectOpened(result.project, result.path ?? null);+ }, [onProjectOpened]);++ const handleDragOver = useCallback((e: React.DragEvent) => {+ e.preventDefault();+ if (e.dataTransfer.items.length > 0) {+ setIsDraggingOver(true);+ }+ }, []);++ const handleDragLeave = useCallback((e: React.DragEvent) => {+ if (!e.currentTarget.contains(e.relatedTarget as Node)) {+ setIsDraggingOver(false);+ }+ }, []);++ const handleDrop = useCallback(+ async (e: React.DragEvent) => {+ e.preventDefault();+ setIsDraggingOver(false);++ const files = Array.from(e.dataTransfer.files);+ if (files.length === 0) return;++ const projectFile = files.find((f) => f.name.endsWith(".openscreen"));+ if (!projectFile) {+ setDropError("unsupported-format");+ return;+ }++ // Use Electron's webUtils.getPathForFile — File.path was removed in Electron 32++ let filePath: string;+ try {+ filePath = window.electronAPI.getPathForFile(projectFile);+ } catch {+ setDropError("load-failed");+ return;+ }+ if (!filePath) {+ setDropError("load-failed");+ return;+ }++ let result: Awaited<ReturnType<typeof window.electronAPI.loadProjectFileFromPath>>;+ try {+ result = await window.electronAPI.loadProjectFileFromPath(filePath);+ } catch {+ setDropError("load-failed");+ return;+ }+ if (!result.success || !result.project) {+ setDropError("load-failed");+ return;+ }++ onProjectOpened(result.project, result.path ?? null);+ },+ [onProjectOpened],+ );++ return (+ <div+ className="flex h-full w-full flex-col items-center justify-center bg-[#09090b]"+ onDragOver={handleDragOver}+ onDragLeave={handleDragLeave}+ onDrop={handleDrop}+ >+ {/* Drop overlay */}+ {isDraggingOver && (+ <div className="pointer-events-none absolute inset-0 z-50 flex flex-col items-center justify-center rounded-xl border-2 border-dashed border-[#34B27B] bg-[#34B27B]/10">+ <Upload className="mb-3 h-10 w-10 text-[#34B27B]" />+ <p className="text-base font-semibold text-[#34B27B]">{te("emptyState.dropOverlay")}</p>+ </div>+ )}++ {/* Drop error dialog */}+ <Dialog open={dropError !== null} onOpenChange={(open) => !open && setDropError(null)}>+ <DialogContent className="bg-[#09090b] border-white/10 rounded-2xl max-w-sm p-6 gap-0">+ <DialogHeader className="mb-4">+ <div className="flex items-center gap-3">+ <img+ src="./openscreen.png"+ alt=""+ aria-hidden="true"+ className="w-9 h-9 rounded-xl flex-shrink-0"+ />+ <DialogTitle className="text-base font-semibold text-slate-200 leading-tight">+ {lastDropErrorRef.current === "unsupported-format"+ ? te("emptyState.dropErrors.unsupportedFormatTitle")+ : te("emptyState.dropErrors.couldNotOpenTitle")}+ </DialogTitle>+ </div>+ </DialogHeader>++ <div className="flex flex-col items-center gap-3 mb-6 text-center">+ <div className="flex items-center justify-center w-10 h-10 rounded-full bg-white/5 ring-1 ring-white/10">+ <AlertCircle className="w-5 h-5 text-slate-400 flex-shrink-0" />+ </div>+ <p className="text-sm text-slate-400 leading-relaxed">+ {lastDropErrorRef.current === "unsupported-format"+ ? te("emptyState.dropErrors.unsupportedFormatMessage")+ : te("emptyState.dropErrors.couldNotOpenMessage")}+ </p>+ </div>++ <button+ type="button"+ onClick={() => setDropError(null)}+ className="flex items-center justify-center gap-2 w-full px-4 py-2.5 rounded-lg bg-white/5 hover:bg-white/10 border border-white/10 text-slate-300 font-medium text-sm transition-colors outline-none focus-visible:ring-2 focus-visible:ring-white/30 focus-visible:ring-offset-2 focus-visible:ring-offset-[#09090b]"+ >+ <X className="w-4 h-4" />+ {tc("actions.close")}+ </button>+ </DialogContent>+ </Dialog>++ <div className="relative flex flex-col items-center gap-8 px-6 text-center">+ {/* Logo */}+ <img+ src="./openscreen.png"+ alt=""+ aria-hidden="true"+ className="h-16 w-16 rounded-2xl opacity-90"+ />++ <div className="flex flex-col gap-2">+ <h2 className="text-xl font-semibold text-slate-200">{te("emptyState.title")}</h2>+ <p className="max-w-sm text-sm leading-relaxed text-slate-500">+ {te("emptyState.description")}+ </p>+ </div>++ {/* Actions */}+ <div className="flex flex-col gap-3 w-full max-w-xs">+ <button+ type="button"+ onClick={handleImportVideo}+ className="flex items-center justify-center gap-2.5 w-full px-4 py-3 rounded-xl bg-[#34B27B] hover:bg-[#2d9e6c] active:bg-[#27885c] text-white font-medium text-sm transition-colors outline-none focus-visible:ring-2 focus-visible:ring-[#34B27B] focus-visible:ring-offset-2 focus-visible:ring-offset-[#09090b]"+ >+ <Film className="h-4 w-4" />+ {te("emptyState.importVideoButton")}+ </button>+ <button+ type="button"+ onClick={handleLoadProject}+ className="flex items-center justify-center gap-2.5 w-full px-4 py-3 rounded-xl bg-white/5 hover:bg-white/10 border border-white/10 text-slate-300 font-medium text-sm transition-colors outline-none focus-visible:ring-2 focus-visible:ring-white/30 focus-visible:ring-offset-2 focus-visible:ring-offset-[#09090b]"+ >+ <FolderOpen className="h-4 w-4" />+ {te("emptyState.loadProjectButton")}+ </button>+ </div>++ <div className="flex flex-col items-center gap-2">+ <p className="text-xs text-slate-600">{te("emptyState.supportedFormats")}</p>+ <div className="flex items-center gap-1.5 text-xs text-slate-700 mt-4">+ <Upload className="h-3 w-3" />+ <span>{te("emptyState.dragDropHint")}</span>+ </div>+ </div>+ </div>+ </div>+ );+}diff --git a/src/components/video-editor/UnsavedChangesDialog.tsx b/src/components/video-editor/UnsavedChangesDialog.tsxindex 902b1427b..f7423b620 100644--- a/src/components/video-editor/UnsavedChangesDialog.tsx+++ b/src/components/video-editor/UnsavedChangesDialog.tsx@@ -10,6 +10,7 @@ import { useScopedT } from "@/contexts/I18nContext";interface UnsavedChangesDialogProps {isOpen: boolean;+ variant?: "close" | "newProject" | "loadProject";onSaveAndClose: () => void;onDiscardAndClose: () => void;onCancel: () => void;@@ -17,6 +18,7 @@ interface UnsavedChangesDialogProps {export function UnsavedChangesDialog({isOpen,+ variant = "close",onSaveAndClose,onDiscardAndClose,onCancel,@@ -24,6 +26,25 @@ export function UnsavedChangesDialog({const td = useScopedT("dialogs");const tc = useScopedT("common");+ const detail =+ variant === "newProject"+ ? td("unsavedChanges.detailNewProject")+ : variant === "loadProject"+ ? td("unsavedChanges.detailLoadProject")+ : td("unsavedChanges.detail");+ const saveLabel =+ variant === "newProject"+ ? td("unsavedChanges.saveAndNewProject")+ : variant === "loadProject"+ ? td("unsavedChanges.saveAndLoadProject")+ : td("unsavedChanges.saveAndClose");+ const discardLabel =+ variant === "newProject"+ ? td("unsavedChanges.discardAndNewProject")+ : variant === "loadProject"+ ? td("unsavedChanges.discardAndLoadProject")+ : td("unsavedChanges.discardAndClose");+return (<Dialog open={isOpen} onOpenChange={(open) => !open && onCancel()}><DialogContent className="bg-[#09090b] border-white/10 rounded-2xl max-w-sm p-6 gap-0">@@ -42,9 +63,7 @@ export function UnsavedChangesDialog({</DialogHeader><p className="text-sm text-slate-300 mb-1">{td("unsavedChanges.message")}</p>- <DialogDescription className="text-sm text-slate-500 mb-6">- {td("unsavedChanges.detail")}- </DialogDescription>+ <DialogDescription className="text-sm text-slate-500 mb-6">{detail}</DialogDescription><div className="flex flex-col gap-2"><button@@ -53,7 +72,7 @@ export function UnsavedChangesDialog({className="flex items-center justify-center gap-2 w-full px-4 py-2.5 rounded-lg bg-[#34B27B] hover:bg-[#2d9e6c] active:bg-[#27885c] text-white font-medium text-sm transition-colors outline-none focus-visible:ring-2 focus-visible:ring-[#34B27B] focus-visible:ring-offset-2 focus-visible:ring-offset-[#09090b]"><Save className="w-4 h-4" />- {td("unsavedChanges.saveAndClose")}+ {saveLabel}</button><buttontype="button"@@ -61,7 +80,7 @@ export function UnsavedChangesDialog({className="flex items-center justify-center gap-2 w-full px-4 py-2.5 rounded-lg bg-white/5 hover:bg-red-500/15 border border-white/10 hover:border-red-500/30 text-slate-300 hover:text-red-400 font-medium text-sm transition-colors outline-none focus-visible:ring-2 focus-visible:ring-white/30 focus-visible:ring-offset-2 focus-visible:ring-offset-[#09090b]"><Trash2 className="w-4 h-4" />- {td("unsavedChanges.discardAndClose")}+ {discardLabel}</button><buttontype="button"diff --git a/src/components/video-editor/VideoEditor.tsx b/src/components/video-editor/VideoEditor.tsxindex b91b7a053..05034632e 100644--- a/src/components/video-editor/VideoEditor.tsx+++ b/src/components/video-editor/VideoEditor.tsx@@ -48,6 +48,7 @@ import {getNativeAspectRatioValue,isPortraitAspectRatio,} from "@/utils/aspectRatioUtils";+import { EditorEmptyState } from "./EditorEmptyState";import { ExportDialog } from "./ExportDialog";import {DEFAULT_CURSOR_SETTINGS,@@ -158,6 +159,7 @@ export default function VideoEditor() {commitState,undo,redo,+ resetState,} = useEditorHistory(INITIAL_EDITOR_STATE);const {@@ -224,6 +226,11 @@ export default function VideoEditor() {} | null>(null);const [isFullscreen, setIsFullscreen] = useState(false);const [showCloseConfirmDialog, setShowCloseConfirmDialog] = useState(false);+ // Unsaved-changes confirmation for New Project / Load Project actions.+ // (The window-close flow uses showCloseConfirmDialog above.)+ const [confirmDialogVariant, setConfirmDialogVariant] = useState<+ "newProject" | "loadProject" | null+ >(null);const playerContainerRef = useRef<HTMLDivElement | null>(null);const cursorTelemetrySourcePath = videoSourcePath ?? (videoPath ? fromFileUrl(videoPath) : null);const { samples: cursorTelemetry, error: cursorTelemetryError } =@@ -525,9 +532,9 @@ export default function VideoEditor() {setLastSavedSnapshot(createProjectSnapshot({ screenVideoPath: result.path }, INITIAL_EDITOR_STATE),);- } else {- setError("No video to load. Please record or select a video.");}+ // No video/project/session — leave videoPath null so the+ // EditorEmptyState dashboard renders instead of an error screen.} catch (err) {setError("Error loading video: " + String(err));} finally {@@ -711,7 +718,7 @@ export default function VideoEditor() {}}, []);- const handleLoadProject = useCallback(async () => {+ const doLoadProject = useCallback(async () => {const result = await nativeBridgeClient.project.loadProjectFile();if (result.canceled) {@@ -732,17 +739,97 @@ export default function VideoEditor() {toast.success(t("project.loadedFrom", { path: result.path ?? "" }));}, [applyLoadedProject, t]);+ const handleLoadProject = useCallback(async () => {+ if (hasUnsavedChanges) {+ setConfirmDialogVariant("loadProject");+ return;+ }+ await doLoadProject();+ }, [hasUnsavedChanges, doLoadProject]);++ const handleLoadProjectConfirmSave = useCallback(async () => {+ setConfirmDialogVariant(null);+ const saved = await saveProject(false);+ if (saved) {+ await doLoadProject();+ }+ }, [saveProject, doLoadProject]);++ const handleLoadProjectConfirmDiscard = useCallback(async () => {+ setConfirmDialogVariant(null);+ await doLoadProject();+ }, [doLoadProject]);++ // New Project: clear all media/project/editor state back to the empty+ // Studio dashboard. Prompts to save first when there are unsaved changes.+ const doNewProject = useCallback(async () => {+ await nativeBridgeClient.project.clearCurrentVideoPath();+ setVideoPath(null);+ setVideoSourcePath(null);+ setWebcamVideoPath(null);+ setWebcamVideoSourcePath(null);+ setCurrentProjectPath(null);+ setLastSavedSnapshot(null);+ // Reset undoable editor state + undo/redo history to a clean slate.+ resetState();+ // Reset non-undoable selection state.+ setSelectedZoomId(null);+ setSelectedTrimId(null);+ setSelectedSpeedId(null);+ setSelectedAnnotationId(null);+ setSelectedBlurId(null);+ // Reset playback.+ setCurrentTime(0);+ setIsPlaying(false);+ // Reset cursor preferences to defaults.+ setShowCursor(DEFAULT_CURSOR_SETTINGS.show);+ setCursorSize(DEFAULT_CURSOR_SETTINGS.size);+ setCursorSmoothing(DEFAULT_CURSOR_SETTINGS.smoothing);+ setCursorMotionBlur(DEFAULT_CURSOR_SETTINGS.motionBlur);+ setCursorClickBounce(DEFAULT_CURSOR_SETTINGS.clickBounce);+ setCursorClipToBounds(DEFAULT_CURSOR_SETTINGS.clipToBounds);+ // Reset region ID counters.+ nextZoomIdRef.current = 1;+ nextTrimIdRef.current = 1;+ nextSpeedIdRef.current = 1;+ nextAnnotationIdRef.current = 1;+ nextAnnotationZIndexRef.current = 1;+ }, [resetState]);++ const handleNewProject = useCallback(async () => {+ if (hasUnsavedChanges) {+ setConfirmDialogVariant("newProject");+ return;+ }+ await doNewProject();+ }, [hasUnsavedChanges, doNewProject]);++ const handleNewProjectConfirmSave = useCallback(async () => {+ setConfirmDialogVariant(null);+ const saved = await saveProject(false);+ if (saved) {+ await doNewProject();+ }+ }, [saveProject, doNewProject]);++ const handleNewProjectConfirmDiscard = useCallback(async () => {+ setConfirmDialogVariant(null);+ await doNewProject();+ }, [doNewProject]);+useEffect(() => {+ const removeNewProjectListener = window.electronAPI.onMenuNewProject(handleNewProject);const removeLoadListener = window.electronAPI.onMenuLoadProject(handleLoadProject);const removeSaveListener = window.electronAPI.onMenuSaveProject(handleSaveProject);const removeSaveAsListener = window.electronAPI.onMenuSaveProjectAs(handleSaveProjectAs);return () => {+ removeNewProjectListener?.();removeLoadListener?.();removeSaveListener?.();removeSaveAsListener?.();};- }, [handleLoadProject, handleSaveProject, handleSaveProjectAs]);+ }, [handleNewProject, handleLoadProject, handleSaveProject, handleSaveProjectAs]);useEffect(() => {let canceled = false;@@ -2050,339 +2137,364 @@ export default function VideoEditor() {</div></div>- <div className="editor-workspace flex-1 min-h-0 relative">- <PanelGroup direction="vertical" className="gap-3 min-h-0">- {/* Top section: preview and contextual settings */}- <Panel defaultSize={67} maxSize={76} minSize={46} className="min-h-[300px]">- <div className="editor-main-deck h-full min-h-0">- <div className="editor-preview-zone min-w-0 h-full">- <div- ref={playerContainerRef}- className={- isFullscreen- ? "fixed inset-0 z-[99999] w-full h-full flex flex-col items-center justify-center bg-[#09090b]"- : "editor-preview-panel w-full h-full flex flex-col items-center justify-center overflow-hidden relative"- }- >- {/* Video preview */}- <div className="w-full min-h-0 flex justify-center items-center flex-auto px-4 pt-4">- <div- className="relative flex justify-center items-center w-auto h-full max-w-full box-border"- style={{- aspectRatio:- aspectRatio === "native"- ? getNativeAspectRatioValue(- videoPlaybackRef.current?.video?.videoWidth ||- DEFAULT_SOURCE_DIMENSIONS.width,- videoPlaybackRef.current?.video?.videoHeight ||- DEFAULT_SOURCE_DIMENSIONS.height,- cropRegion,- )- : getAspectRatioValue(aspectRatio),- }}- >- <VideoPlayback- key={`${videoPath || "no-video"}:${webcamVideoPath || "no-webcam"}`}- aspectRatio={aspectRatio}- ref={videoPlaybackRef}- videoPath={videoPath || ""}- webcamVideoPath={webcamVideoPath || undefined}- webcamLayoutPreset={webcamLayoutPreset}- webcamMaskShape={webcamMaskShape}- webcamSizePreset={webcamSizePreset}- webcamPosition={webcamPosition}- onWebcamPositionChange={(pos) => updateState({ webcamPosition: pos })}- onWebcamPositionDragEnd={commitState}- onDurationChange={setDuration}- onTimeUpdate={setCurrentTime}- currentTime={currentTime}- onPlayStateChange={setIsPlaying}- onError={setError}- wallpaper={wallpaper}- zoomRegions={zoomRegions}- selectedZoomId={selectedZoomId}- onSelectZoom={handleSelectZoom}- onZoomFocusChange={handleZoomFocusChange}- onZoomFocusDragEnd={commitState}- isPlaying={isPlaying}- showShadow={shadowIntensity > 0}- shadowIntensity={shadowIntensity}- showBlur={showBlur}- motionBlurAmount={motionBlurAmount}- borderRadius={borderRadius}- padding={padding}- cropRegion={cropRegion}- cursorRecordingData={cursorRecordingData}- trimRegions={trimRegions}- speedRegions={speedRegions}- annotationRegions={annotationOnlyRegions}- selectedAnnotationId={selectedAnnotationId}- onSelectAnnotation={handleSelectAnnotation}- onAnnotationPositionChange={handleAnnotationPositionChange}- onAnnotationSizeChange={handleAnnotationSizeChange}- blurRegions={blurRegions}- selectedBlurId={selectedBlurId}- onSelectBlur={handleSelectBlur}- onBlurPositionChange={handleAnnotationPositionChange}- onBlurSizeChange={handleAnnotationSizeChange}- onBlurDataChange={handleBlurDataPreviewChange}- onBlurDataCommit={commitState}- cursorTelemetry={cursorTelemetry}- cursorClickTimestamps={cursorClickTimestamps}- showCursor={effectiveShowCursor}- cursorSize={cursorSize}- cursorSmoothing={cursorSmoothing}- cursorMotionBlur={cursorMotionBlur}- cursorClickBounce={cursorClickBounce}- cursorClipToBounds={cursorClipToBounds}- isPreviewingZoom={isPreviewingZoom}- />+ {/* Empty state — shown when no video is loaded */}+ {!videoPath && (+ <div className="flex-1 min-h-0 relative">+ <EditorEmptyState+ onVideoImported={(path) => {+ setVideoPath(toFileUrl(path));+ setVideoSourcePath(path);+ setWebcamVideoPath(null);+ setWebcamVideoSourcePath(null);+ }}+ onProjectOpened={async (project, path) => {+ const restored = await applyLoadedProject(project, path);+ if (!restored) {+ toast.error(t("project.invalidFormat"));+ }+ }}+ />+ </div>+ )}++ {videoPath && (+ <div className="editor-workspace flex-1 min-h-0 relative">+ <PanelGroup direction="vertical" className="gap-3 min-h-0">+ {/* Top section: preview and contextual settings */}+ <Panel defaultSize={67} maxSize={76} minSize={46} className="min-h-[300px]">+ <div className="editor-main-deck h-full min-h-0">+ <div className="editor-preview-zone min-w-0 h-full">+ <div+ ref={playerContainerRef}+ className={+ isFullscreen+ ? "fixed inset-0 z-[99999] w-full h-full flex flex-col items-center justify-center bg-[#09090b]"+ : "editor-preview-panel w-full h-full flex flex-col items-center justify-center overflow-hidden relative"+ }+ >+ {/* Video preview */}+ <div className="w-full min-h-0 flex justify-center items-center flex-auto px-4 pt-4">+ <div+ className="relative flex justify-center items-center w-auto h-full max-w-full box-border"+ style={{+ aspectRatio:+ aspectRatio === "native"+ ? getNativeAspectRatioValue(+ videoPlaybackRef.current?.video?.videoWidth ||+ DEFAULT_SOURCE_DIMENSIONS.width,+ videoPlaybackRef.current?.video?.videoHeight ||+ DEFAULT_SOURCE_DIMENSIONS.height,+ cropRegion,+ )+ : getAspectRatioValue(aspectRatio),+ }}+ >+ <VideoPlayback+ key={`${videoPath || "no-video"}:${webcamVideoPath || "no-webcam"}`}+ aspectRatio={aspectRatio}+ ref={videoPlaybackRef}+ videoPath={videoPath || ""}+ webcamVideoPath={webcamVideoPath || undefined}+ webcamLayoutPreset={webcamLayoutPreset}+ webcamMaskShape={webcamMaskShape}+ webcamSizePreset={webcamSizePreset}+ webcamPosition={webcamPosition}+ onWebcamPositionChange={(pos) => updateState({ webcamPosition: pos })}+ onWebcamPositionDragEnd={commitState}+ onDurationChange={setDuration}+ onTimeUpdate={setCurrentTime}+ currentTime={currentTime}+ onPlayStateChange={setIsPlaying}+ onError={setError}+ wallpaper={wallpaper}+ zoomRegions={zoomRegions}+ selectedZoomId={selectedZoomId}+ onSelectZoom={handleSelectZoom}+ onZoomFocusChange={handleZoomFocusChange}+ onZoomFocusDragEnd={commitState}+ isPlaying={isPlaying}+ showShadow={shadowIntensity > 0}+ shadowIntensity={shadowIntensity}+ showBlur={showBlur}+ motionBlurAmount={motionBlurAmount}+ borderRadius={borderRadius}+ padding={padding}+ cropRegion={cropRegion}+ cursorRecordingData={cursorRecordingData}+ trimRegions={trimRegions}+ speedRegions={speedRegions}+ annotationRegions={annotationOnlyRegions}+ selectedAnnotationId={selectedAnnotationId}+ onSelectAnnotation={handleSelectAnnotation}+ onAnnotationPositionChange={handleAnnotationPositionChange}+ onAnnotationSizeChange={handleAnnotationSizeChange}+ blurRegions={blurRegions}+ selectedBlurId={selectedBlurId}+ onSelectBlur={handleSelectBlur}+ onBlurPositionChange={handleAnnotationPositionChange}+ onBlurSizeChange={handleAnnotationSizeChange}+ onBlurDataChange={handleBlurDataPreviewChange}+ onBlurDataCommit={commitState}+ cursorTelemetry={cursorTelemetry}+ cursorClickTimestamps={cursorClickTimestamps}+ showCursor={effectiveShowCursor}+ cursorSize={cursorSize}+ cursorSmoothing={cursorSmoothing}+ cursorMotionBlur={cursorMotionBlur}+ cursorClickBounce={cursorClickBounce}+ cursorClipToBounds={cursorClipToBounds}+ isPreviewingZoom={isPreviewingZoom}+ />+ </div></div>- </div>- {/* Playback controls */}- <div className="w-full flex justify-center items-center h-14 flex-shrink-0 px-4 py-2">- <div className="w-full max-w-[760px]">- <PlaybackControls- isPlaying={isPlaying}- currentTime={currentTime}- duration={duration}- isFullscreen={isFullscreen}- onToggleFullscreen={toggleFullscreen}- onTogglePlayPause={togglePlayPause}- onSeek={handleSeek}- />+ {/* Playback controls */}+ <div className="w-full flex justify-center items-center h-14 flex-shrink-0 px-4 py-2">+ <div className="w-full max-w-[760px]">+ <PlaybackControls+ isPlaying={isPlaying}+ currentTime={currentTime}+ duration={duration}+ isFullscreen={isFullscreen}+ onToggleFullscreen={toggleFullscreen}+ onTogglePlayPause={togglePlayPause}+ onSeek={handleSeek}+ />+ </div></div></div></div>- </div>- <div className="editor-settings-rail min-w-0 h-full">- <SettingsPanel- selected={wallpaper}- onWallpaperChange={(w) => pushState({ wallpaper: w })}- selectedZoomDepth={- selectedZoomId ? zoomRegions.find((z) => z.id === selectedZoomId)?.depth : null- }- onZoomDepthChange={(depth) => selectedZoomId && handleZoomDepthChange(depth)}- selectedZoomCustomScale={- selectedZoomId- ? (zoomRegions.find((z) => z.id === selectedZoomId)?.customScale ?? null)- : null- }- onZoomCustomScaleChange={handleZoomCustomScaleChange}- onZoomCustomScaleCommit={handleZoomCustomScaleCommit}- onZoomPreviewStart={() => setIsPreviewingZoom(true)}- onZoomPreviewEnd={() => setIsPreviewingZoom(false)}- selectedZoomFocusMode={- selectedZoomId- ? (zoomRegions.find((z) => z.id === selectedZoomId)?.focusMode ?? "manual")- : null- }- onZoomFocusModeChange={(mode) =>- selectedZoomId && handleZoomFocusModeChange(mode)- }- selectedZoomFocus={- selectedZoomId- ? (zoomRegions.find((z) => z.id === selectedZoomId)?.focus ?? null)- : null- }- onZoomFocusCoordinateChange={(focus) =>- selectedZoomId && handleZoomFocusChange(selectedZoomId, focus)- }- onZoomFocusCoordinateCommit={commitState}- hasCursorTelemetry={cursorTelemetry.length > 0}- selectedZoomId={selectedZoomId}+ <div className="editor-settings-rail min-w-0 h-full">+ <SettingsPanel+ selected={wallpaper}+ onWallpaperChange={(w) => pushState({ wallpaper: w })}+ selectedZoomDepth={+ selectedZoomId+ ? zoomRegions.find((z) => z.id === selectedZoomId)?.depth+ : null+ }+ onZoomDepthChange={(depth) => selectedZoomId && handleZoomDepthChange(depth)}+ selectedZoomCustomScale={+ selectedZoomId+ ? (zoomRegions.find((z) => z.id === selectedZoomId)?.customScale ?? null)+ : null+ }+ onZoomCustomScaleChange={handleZoomCustomScaleChange}+ onZoomCustomScaleCommit={handleZoomCustomScaleCommit}+ onZoomPreviewStart={() => setIsPreviewingZoom(true)}+ onZoomPreviewEnd={() => setIsPreviewingZoom(false)}+ selectedZoomFocusMode={+ selectedZoomId+ ? (zoomRegions.find((z) => z.id === selectedZoomId)?.focusMode ?? "manual")+ : null+ }+ onZoomFocusModeChange={(mode) =>+ selectedZoomId && handleZoomFocusModeChange(mode)+ }+ selectedZoomFocus={+ selectedZoomId+ ? (zoomRegions.find((z) => z.id === selectedZoomId)?.focus ?? null)+ : null+ }+ onZoomFocusCoordinateChange={(focus) =>+ selectedZoomId && handleZoomFocusChange(selectedZoomId, focus)+ }+ onZoomFocusCoordinateCommit={commitState}+ hasCursorTelemetry={cursorTelemetry.length > 0}+ selectedZoomId={selectedZoomId}+ onZoomDelete={handleZoomDelete}+ selectedZoomRotationPreset={+ selectedZoomId+ ? (zoomRegions.find((z) => z.id === selectedZoomId)?.rotationPreset ?? null)+ : null+ }+ onZoomRotationPresetChange={handleZoomRotationPresetChange}+ selectedTrimId={selectedTrimId}+ onTrimDelete={handleTrimDelete}+ shadowIntensity={shadowIntensity}+ onShadowChange={(v) => updateState({ shadowIntensity: v })}+ onShadowCommit={commitState}+ showBlur={showBlur}+ onBlurChange={(v) => pushState({ showBlur: v })}+ showTrimWaveform={showTrimWaveform}+ onTrimWaveformChange={(v) => pushState({ showTrimWaveform: v })}+ motionBlurAmount={motionBlurAmount}+ onMotionBlurChange={(v) => updateState({ motionBlurAmount: v })}+ onMotionBlurCommit={commitState}+ borderRadius={borderRadius}+ onBorderRadiusChange={(v) => updateState({ borderRadius: v })}+ onBorderRadiusCommit={commitState}+ padding={padding}+ onPaddingChange={(v) => updateState({ padding: v })}+ onPaddingCommit={commitState}+ cropRegion={cropRegion}+ onCropChange={(r) => pushState({ cropRegion: r })}+ aspectRatio={aspectRatio}+ hasWebcam={Boolean(webcamVideoPath)}+ webcamLayoutPreset={webcamLayoutPreset}+ onWebcamLayoutPresetChange={(preset) =>+ pushState({+ webcamLayoutPreset: preset,+ webcamPosition: preset === "picture-in-picture" ? webcamPosition : null,+ })+ }+ webcamMaskShape={webcamMaskShape}+ onWebcamMaskShapeChange={(shape) => pushState({ webcamMaskShape: shape })}+ webcamSizePreset={webcamSizePreset}+ onWebcamSizePresetChange={(v) => updateState({ webcamSizePreset: v })}+ onWebcamSizePresetCommit={commitState}+ videoElement={videoPlaybackRef.current?.video || null}+ exportQuality={exportQuality}+ onExportQualityChange={setExportQuality}+ exportFormat={exportFormat}+ onExportFormatChange={setExportFormat}+ gifFrameRate={gifFrameRate}+ onGifFrameRateChange={setGifFrameRate}+ gifLoop={gifLoop}+ onGifLoopChange={setGifLoop}+ gifSizePreset={gifSizePreset}+ onGifSizePresetChange={setGifSizePreset}+ gifOutputDimensions={calculateOutputDimensions(+ calculateEffectiveSourceDimensions(+ videoPlaybackRef.current?.video?.videoWidth ||+ DEFAULT_SOURCE_DIMENSIONS.width,+ videoPlaybackRef.current?.video?.videoHeight ||+ DEFAULT_SOURCE_DIMENSIONS.height,+ cropRegion,+ ).width,+ calculateEffectiveSourceDimensions(+ videoPlaybackRef.current?.video?.videoWidth ||+ DEFAULT_SOURCE_DIMENSIONS.width,+ videoPlaybackRef.current?.video?.videoHeight ||+ DEFAULT_SOURCE_DIMENSIONS.height,+ cropRegion,+ ).height,+ gifSizePreset,+ GIF_SIZE_PRESETS,+ aspectRatio === "native"+ ? getNativeAspectRatioValue(+ videoPlaybackRef.current?.video?.videoWidth ||+ DEFAULT_SOURCE_DIMENSIONS.width,+ videoPlaybackRef.current?.video?.videoHeight ||+ DEFAULT_SOURCE_DIMENSIONS.height,+ cropRegion,+ )+ : getAspectRatioValue(aspectRatio),+ )}+ onExport={handleOpenExportDialog}+ onExportPanelOpen={() => {+ setSelectedZoomId(null);+ setSelectedTrimId(null);+ setSelectedSpeedId(null);+ }}+ selectedAnnotationId={selectedAnnotationId}+ annotationRegions={annotationOnlyRegions}+ onAnnotationContentChange={handleAnnotationContentChange}+ onAnnotationTypeChange={handleAnnotationTypeChange}+ onAnnotationStyleChange={handleAnnotationStyleChange}+ onAnnotationFigureDataChange={handleAnnotationFigureDataChange}+ onAnnotationDuplicate={handleAnnotationDuplicate}+ onAnnotationDelete={handleAnnotationDelete}+ selectedBlurId={selectedBlurId}+ blurRegions={blurRegions}+ onBlurDataChange={handleBlurDataPanelChange}+ onBlurDataCommit={commitState}+ onBlurDelete={handleAnnotationDelete}+ selectedSpeedId={selectedSpeedId}+ selectedSpeedValue={+ selectedSpeedId+ ? (speedRegions.find((r) => r.id === selectedSpeedId)?.speed ?? null)+ : null+ }+ onSpeedChange={handleSpeedChange}+ onSpeedDelete={handleSpeedDelete}+ unsavedExport={unsavedExport}+ onSaveUnsavedExport={handleSaveUnsavedExport}+ onSaveDiagnostic={handleSaveDiagnostic}+ showCursor={showCursor}+ onShowCursorChange={setShowCursor}+ cursorSize={cursorSize}+ onCursorSizeChange={setCursorSize}+ cursorSmoothing={cursorSmoothing}+ onCursorSmoothingChange={setCursorSmoothing}+ cursorMotionBlur={cursorMotionBlur}+ onCursorMotionBlurChange={setCursorMotionBlur}+ cursorClickBounce={cursorClickBounce}+ onCursorClickBounceChange={setCursorClickBounce}+ cursorClipToBounds={cursorClipToBounds}+ onCursorClipToBoundsChange={setCursorClipToBounds}+ hasCursorData={+ cursorTelemetry.length > 0 ||+ hasNativeCursorRecordingData(cursorRecordingData)+ }+ showCursorSettings={showCursorSettings}+ />+ </div>+ </div>+ </Panel>++ <PanelResizeHandle className="editor-resize-handle group">+ <div className="w-10 h-1 bg-white/20 rounded-full transition-colors group-hover:bg-[#34B27B]/70"></div>+ </PanelResizeHandle>++ {/* Full-width timeline */}+ <Panel defaultSize={33} maxSize={54} minSize={24} className="min-h-[210px]">+ <div className="editor-timeline-panel h-full overflow-hidden flex flex-col">+ <TimelineEditor+ videoDuration={duration}+ currentTime={currentTime}+ onSeek={handleSeek}+ cursorTelemetry={cursorTelemetry}+ zoomRegions={zoomRegions}+ onZoomAdded={handleZoomAdded}+ onZoomSuggested={handleZoomSuggested}+ onZoomSpanChange={handleZoomSpanChange}onZoomDelete={handleZoomDelete}- selectedZoomRotationPreset={- selectedZoomId- ? (zoomRegions.find((z) => z.id === selectedZoomId)?.rotationPreset ?? null)- : null- }- onZoomRotationPresetChange={handleZoomRotationPresetChange}- selectedTrimId={selectedTrimId}+ selectedZoomId={selectedZoomId}+ onSelectZoom={handleSelectZoom}+ trimRegions={trimRegions}+ onTrimAdded={handleTrimAdded}+ onTrimSpanChange={handleTrimSpanChange}onTrimDelete={handleTrimDelete}- shadowIntensity={shadowIntensity}- onShadowChange={(v) => updateState({ shadowIntensity: v })}- onShadowCommit={commitState}- showBlur={showBlur}- onBlurChange={(v) => pushState({ showBlur: v })}- showTrimWaveform={showTrimWaveform}- onTrimWaveformChange={(v) => pushState({ showTrimWaveform: v })}- motionBlurAmount={motionBlurAmount}- onMotionBlurChange={(v) => updateState({ motionBlurAmount: v })}- onMotionBlurCommit={commitState}- borderRadius={borderRadius}- onBorderRadiusChange={(v) => updateState({ borderRadius: v })}- onBorderRadiusCommit={commitState}- padding={padding}- onPaddingChange={(v) => updateState({ padding: v })}- onPaddingCommit={commitState}- cropRegion={cropRegion}- onCropChange={(r) => pushState({ cropRegion: r })}- aspectRatio={aspectRatio}- hasWebcam={Boolean(webcamVideoPath)}- webcamLayoutPreset={webcamLayoutPreset}- onWebcamLayoutPresetChange={(preset) =>- pushState({- webcamLayoutPreset: preset,- webcamPosition: preset === "picture-in-picture" ? webcamPosition : null,- })- }- webcamMaskShape={webcamMaskShape}- onWebcamMaskShapeChange={(shape) => pushState({ webcamMaskShape: shape })}- webcamSizePreset={webcamSizePreset}- onWebcamSizePresetChange={(v) => updateState({ webcamSizePreset: v })}- onWebcamSizePresetCommit={commitState}- videoElement={videoPlaybackRef.current?.video || null}- exportQuality={exportQuality}- onExportQualityChange={setExportQuality}- exportFormat={exportFormat}- onExportFormatChange={setExportFormat}- gifFrameRate={gifFrameRate}- onGifFrameRateChange={setGifFrameRate}- gifLoop={gifLoop}- onGifLoopChange={setGifLoop}- gifSizePreset={gifSizePreset}- onGifSizePresetChange={setGifSizePreset}- gifOutputDimensions={calculateOutputDimensions(- calculateEffectiveSourceDimensions(- videoPlaybackRef.current?.video?.videoWidth ||- DEFAULT_SOURCE_DIMENSIONS.width,- videoPlaybackRef.current?.video?.videoHeight ||- DEFAULT_SOURCE_DIMENSIONS.height,- cropRegion,- ).width,- calculateEffectiveSourceDimensions(- videoPlaybackRef.current?.video?.videoWidth ||- DEFAULT_SOURCE_DIMENSIONS.width,- videoPlaybackRef.current?.video?.videoHeight ||- DEFAULT_SOURCE_DIMENSIONS.height,- cropRegion,- ).height,- gifSizePreset,- GIF_SIZE_PRESETS,- aspectRatio === "native"- ? getNativeAspectRatioValue(- videoPlaybackRef.current?.video?.videoWidth ||- DEFAULT_SOURCE_DIMENSIONS.width,- videoPlaybackRef.current?.video?.videoHeight ||- DEFAULT_SOURCE_DIMENSIONS.height,- cropRegion,- )- : getAspectRatioValue(aspectRatio),- )}- onExport={handleOpenExportDialog}- onExportPanelOpen={() => {- setSelectedZoomId(null);- setSelectedTrimId(null);- setSelectedSpeedId(null);- }}- selectedAnnotationId={selectedAnnotationId}+ selectedTrimId={selectedTrimId}+ onSelectTrim={handleSelectTrim}+ speedRegions={speedRegions}+ onSpeedAdded={handleSpeedAdded}+ onSpeedSpanChange={handleSpeedSpanChange}+ onSpeedDelete={handleSpeedDelete}+ selectedSpeedId={selectedSpeedId}+ onSelectSpeed={handleSelectSpeed}annotationRegions={annotationOnlyRegions}- onAnnotationContentChange={handleAnnotationContentChange}- onAnnotationTypeChange={handleAnnotationTypeChange}- onAnnotationStyleChange={handleAnnotationStyleChange}- onAnnotationFigureDataChange={handleAnnotationFigureDataChange}- onAnnotationDuplicate={handleAnnotationDuplicate}+ onAnnotationAdded={handleAnnotationAdded}+ onAnnotationSpanChange={handleAnnotationSpanChange}onAnnotationDelete={handleAnnotationDelete}- selectedBlurId={selectedBlurId}+ selectedAnnotationId={selectedAnnotationId}+ onSelectAnnotation={handleSelectAnnotation}blurRegions={blurRegions}- onBlurDataChange={handleBlurDataPanelChange}- onBlurDataCommit={commitState}+ onBlurAdded={handleBlurAdded}+ onBlurSpanChange={handleAnnotationSpanChange}onBlurDelete={handleAnnotationDelete}- selectedSpeedId={selectedSpeedId}- selectedSpeedValue={- selectedSpeedId- ? (speedRegions.find((r) => r.id === selectedSpeedId)?.speed ?? null)- : null- }- onSpeedChange={handleSpeedChange}- onSpeedDelete={handleSpeedDelete}- unsavedExport={unsavedExport}- onSaveUnsavedExport={handleSaveUnsavedExport}- onSaveDiagnostic={handleSaveDiagnostic}- showCursor={showCursor}- onShowCursorChange={setShowCursor}- cursorSize={cursorSize}- onCursorSizeChange={setCursorSize}- cursorSmoothing={cursorSmoothing}- onCursorSmoothingChange={setCursorSmoothing}- cursorMotionBlur={cursorMotionBlur}- onCursorMotionBlurChange={setCursorMotionBlur}- cursorClickBounce={cursorClickBounce}- onCursorClickBounceChange={setCursorClickBounce}- cursorClipToBounds={cursorClipToBounds}- onCursorClipToBoundsChange={setCursorClipToBounds}- hasCursorData={- cursorTelemetry.length > 0 || hasNativeCursorRecordingData(cursorRecordingData)+ selectedBlurId={selectedBlurId}+ onSelectBlur={handleSelectBlur}+ aspectRatio={aspectRatio}+ onAspectRatioChange={(ar) =>+ pushState({+ aspectRatio: ar,+ webcamLayoutPreset:+ (isPortraitAspectRatio(ar) && webcamLayoutPreset === "dual-frame") ||+ (!isPortraitAspectRatio(ar) && webcamLayoutPreset === "vertical-stack")+ ? "picture-in-picture"+ : webcamLayoutPreset,+ })}- showCursorSettings={showCursorSettings}+ videoUrl={videoPath ?? undefined}+ showTrimWaveform={showTrimWaveform}/></div>- </div>- </Panel>-- <PanelResizeHandle className="editor-resize-handle group">- <div className="w-10 h-1 bg-white/20 rounded-full transition-colors group-hover:bg-[#34B27B]/70"></div>- </PanelResizeHandle>-- {/* Full-width timeline */}- <Panel defaultSize={33} maxSize={54} minSize={24} className="min-h-[210px]">- <div className="editor-timeline-panel h-full overflow-hidden flex flex-col">- <TimelineEditor- videoDuration={duration}- currentTime={currentTime}- onSeek={handleSeek}- cursorTelemetry={cursorTelemetry}- zoomRegions={zoomRegions}- onZoomAdded={handleZoomAdded}- onZoomSuggested={handleZoomSuggested}- onZoomSpanChange={handleZoomSpanChange}- onZoomDelete={handleZoomDelete}- selectedZoomId={selectedZoomId}- onSelectZoom={handleSelectZoom}- trimRegions={trimRegions}- onTrimAdded={handleTrimAdded}- onTrimSpanChange={handleTrimSpanChange}- onTrimDelete={handleTrimDelete}- selectedTrimId={selectedTrimId}- onSelectTrim={handleSelectTrim}- speedRegions={speedRegions}- onSpeedAdded={handleSpeedAdded}- onSpeedSpanChange={handleSpeedSpanChange}- onSpeedDelete={handleSpeedDelete}- selectedSpeedId={selectedSpeedId}- onSelectSpeed={handleSelectSpeed}- annotationRegions={annotationOnlyRegions}- onAnnotationAdded={handleAnnotationAdded}- onAnnotationSpanChange={handleAnnotationSpanChange}- onAnnotationDelete={handleAnnotationDelete}- selectedAnnotationId={selectedAnnotationId}- onSelectAnnotation={handleSelectAnnotation}- blurRegions={blurRegions}- onBlurAdded={handleBlurAdded}- onBlurSpanChange={handleAnnotationSpanChange}- onBlurDelete={handleAnnotationDelete}- selectedBlurId={selectedBlurId}- onSelectBlur={handleSelectBlur}- aspectRatio={aspectRatio}- onAspectRatioChange={(ar) =>- pushState({- aspectRatio: ar,- webcamLayoutPreset:- (isPortraitAspectRatio(ar) && webcamLayoutPreset === "dual-frame") ||- (!isPortraitAspectRatio(ar) && webcamLayoutPreset === "vertical-stack")- ? "picture-in-picture"- : webcamLayoutPreset,- })- }- videoUrl={videoPath ?? undefined}- showTrimWaveform={showTrimWaveform}- />- </div>- </Panel>- </PanelGroup>- </div>+ </Panel>+ </PanelGroup>+ </div>+ )}<ExportDialogisOpen={showExportDialog}@@ -2404,6 +2516,22 @@ export default function VideoEditor() {onDiscardAndClose={handleCloseConfirmDiscard}onCancel={handleCloseConfirmCancel}/>++ <UnsavedChangesDialog+ isOpen={confirmDialogVariant !== null}+ variant={confirmDialogVariant ?? "newProject"}+ onSaveAndClose={+ confirmDialogVariant === "loadProject"+ ? handleLoadProjectConfirmSave+ : handleNewProjectConfirmSave+ }+ onDiscardAndClose={+ confirmDialogVariant === "loadProject"+ ? handleLoadProjectConfirmDiscard+ : handleNewProjectConfirmDiscard+ }+ onCancel={() => setConfirmDialogVariant(null)}+ /></div>);}diff --git a/src/components/video-editor/VideoPlayback.tsx b/src/components/video-editor/VideoPlayback.tsxindex 3b5a93ec5..9f7d8a17d 100644--- a/src/components/video-editor/VideoPlayback.tsx+++ b/src/components/video-editor/VideoPlayback.tsx@@ -60,13 +60,13 @@ import {type CursorTelemetryPoint,computeRotation3DContainScale,DEFAULT_ROTATION_3D,+ getZoomScale,isRotation3DIdentity,lerpRotation3D,rotation3DPerspective,type SpeedRegion,type TrimRegion,ZOOM_DEPTH_SCALES,- type ZoomDepth,type ZoomFocus,type ZoomRegion,} from "./types";@@ -84,7 +84,7 @@ import {PixiCursorOverlay,preloadCursorAssets,} from "./videoPlayback/cursorRenderer";-import { clampFocusToStage as clampFocusToStageUtil } from "./videoPlayback/focusUtils";+import { clampFocusToScale } from "./videoPlayback/focusUtils";import { layoutVideoContent as layoutVideoContentUtil } from "./videoPlayback/layoutUtils";import { clamp01 } from "./videoPlayback/mathUtils";import { updateOverlayIndicator } from "./videoPlayback/overlayUtils";@@ -477,8 +477,19 @@ const VideoPlayback = forwardRef<VideoPlaybackRef, VideoPlaybackProps>([onDurationChange, syncResolvedDuration],);- const clampFocusToStage = useCallback((focus: ZoomFocus, depth: ZoomDepth) => {- return clampFocusToStageUtil(focus, depth, stageSizeRef.current);+ // IMPORTANT: must use clampFocusToScale(focus, getZoomScale(region)) here,+ // NOT clampFocusToStage(focus, region.depth).+ //+ // region.depth is the preset slot (1×/2×/4×) and ignores customScale entirely.+ // getZoomScale(region) returns customScale when set, falling back to the preset+ // depth scale — so drag-to-reposition respects the actual zoom level the user+ // configured, not the preset bucket it sits in.+ //+ // This was previously broken (invisible drag boundaries near canvas edges) and+ // has been fixed twice. If you're refactoring this drag handler, keep this call+ // as clampFocusForRegion(focus, region) — do not switch it back to region.depth.+ const clampFocusForRegion = useCallback((focus: ZoomFocus, region: ZoomRegion) => {+ return clampFocusToScale(focus, getZoomScale(region));}, []);const updateOverlayForRegion = useCallback(@@ -672,7 +683,7 @@ const VideoPlayback = forwardRef<VideoPlaybackRef, VideoPlaybackProps>(cx: clamp01(localX / stageWidth),cy: clamp01(localY / stageHeight),};- const clampedFocus = clampFocusToStage(unclampedFocus, region.depth);+ const clampedFocus = clampFocusForRegion(unclampedFocus, region);onZoomFocusChange(region.id, clampedFocus);updateOverlayForRegion({ ...region, focus: clampedFocus }, clampedFocus);diff --git a/src/hooks/useEditorHistory.ts b/src/hooks/useEditorHistory.tsindex bfa1a4bed..25b6e21a1 100644--- a/src/hooks/useEditorHistory.ts+++ b/src/hooks/useEditorHistory.ts@@ -130,6 +130,11 @@ export function useEditorHistory(initial: EditorState = INITIAL_EDITOR_STATE) {dirtyRef.current = false;}, []);+ const resetState = useCallback((newInitial: EditorState = INITIAL_EDITOR_STATE) => {+ setHistory({ past: [], present: newInitial, future: [] });+ dirtyRef.current = false;+ }, []);+return {state: history.present,pushState,@@ -137,6 +142,7 @@ export function useEditorHistory(initial: EditorState = INITIAL_EDITOR_STATE) {commitState,undo,redo,+ resetState,canUndo: history.past.length > 0,canRedo: history.future.length > 0,};