From 43116a1bc303f4f841f08f2832f95c4b54d5bd82 Mon Sep 17 00:00:00 2001 From: Siddharth Date: Sat, 8 Nov 2025 22:35:12 -0700 Subject: [PATCH] zoom levels and selection --- src/components/video-editor/SettingsPanel.tsx | 38 +++++++------------ src/components/video-editor/timeline/Item.tsx | 10 +++-- .../video-editor/timeline/TimelineEditor.tsx | 2 +- src/components/video-editor/types.ts | 8 ++-- 4 files changed, 26 insertions(+), 32 deletions(-) diff --git a/src/components/video-editor/SettingsPanel.tsx b/src/components/video-editor/SettingsPanel.tsx index 5045eec..4d43e3b 100644 --- a/src/components/video-editor/SettingsPanel.tsx +++ b/src/components/video-editor/SettingsPanel.tsx @@ -2,12 +2,11 @@ import { cn } from "@/lib/utils"; import { Switch } from "@/components/ui/switch"; import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"; import { Button } from "@/components/ui/button"; -import { useMemo, useState } from "react"; +import { useState } from "react"; import Colorful from '@uiw/react-color-colorful'; import { hsvaToHex } from '@uiw/color-convert'; import { Trash2 } from "lucide-react"; import type { ZoomDepth } from "./types"; -import { ZOOM_DEPTH_SCALES } from "./types"; const WALLPAPER_COUNT = 12; const WALLPAPER_PATHS = Array.from({ length: WALLPAPER_COUNT }, (_, i) => `/wallpapers/wallpaper${i + 1}.jpg`); @@ -35,10 +34,12 @@ interface SettingsPanelProps { onZoomDelete?: (id: string) => void; } -const ZOOM_DEPTH_OPTIONS: Array<{ depth: ZoomDepth; label: string; description: string }> = [ - { depth: 1, label: "Subtle", description: "Gentle focus" }, - { depth: 2, label: "Medium", description: "Balanced zoom" }, - { depth: 3, label: "Deep", description: "Bold spotlight" }, +const ZOOM_DEPTH_OPTIONS: Array<{ depth: ZoomDepth; label: string }> = [ + { depth: 1, label: "1.25×" }, + { depth: 2, label: "1.5×" }, + { depth: 3, label: "1.8×" }, + { depth: 4, label: "2.2×" }, + { depth: 5, label: "3.5×" }, ]; export function SettingsPanel({ selected, onWallpaperChange, selectedZoomDepth, onZoomDepthChange, selectedZoomId, onZoomDelete }: SettingsPanelProps) { @@ -52,26 +53,19 @@ export function SettingsPanel({ selected, onWallpaperChange, selectedZoomDepth, onZoomDelete(selectedZoomId); } }; - const scaleLabels = useMemo(() => { - return ZOOM_DEPTH_OPTIONS.reduce>((acc, option) => { - const scale = ZOOM_DEPTH_SCALES[option.depth]; - acc[option.depth] = `${scale.toFixed(2)}×`; - return acc; - }, { 1: "", 2: "", 3: "" }); - }, []); return (
- Zoom Region + Zoom Level {zoomEnabled && selectedZoomDepth && ( - Active · {scaleLabels[selectedZoomDepth]} + Active · {ZOOM_DEPTH_OPTIONS.find(o => o.depth === selectedZoomDepth)?.label} )}
-
+
{ZOOM_DEPTH_OPTIONS.map((option) => { const isActive = selectedZoomDepth === option.depth; return ( @@ -82,25 +76,21 @@ export function SettingsPanel({ selected, onWallpaperChange, selectedZoomDepth, disabled={!zoomEnabled} onClick={() => onZoomDepthChange?.(option.depth)} className={cn( - "h-auto w-full rounded-xl border bg-muted/30 px-4 py-4 text-left shadow-sm transition-all", - "flex flex-col gap-2", + "h-auto w-full rounded-lg border bg-muted/30 px-2 py-2.5 text-center shadow-sm transition-all", + "flex flex-col items-center justify-center gap-0.5", zoomEnabled ? "opacity-100" : "opacity-60", isActive ? "border-primary/70 bg-primary/10 text-primary shadow-primary/20" : "border-border/60 hover:border-primary/40 hover:bg-muted/60" )} > - {option.label} - - {scaleLabels[option.depth]} - - {option.description} + {option.label} ); })}
{!zoomEnabled && ( -

Select a zoom region in the timeline to adjust its depth.

+

Select a zoom item in the timeline to adjust its depth.

)} {zoomEnabled && (