Skip to content

Create polished demo videos without editing skills. Mac/Windows/Linux

Add click effects and zoom/export fixes

webadderallf14352f11996
diff --git a/src/components/video-editor/SettingsPanel.tsx b/src/components/video-editor/SettingsPanel.tsx
index cff898a5..c2030025 100644
--- a/src/components/video-editor/SettingsPanel.tsx
+++ b/src/components/video-editor/SettingsPanel.tsx
@@ -9,6 +9,7 @@ import {
import { AnimatePresence, LayoutGroup, motion } from "motion/react";
import { useEffect, useMemo, useRef, useState } from "react";
import { toast } from "sonner";
+import minimalCursorUrl from "@/assets/cursors/custom/minimal-cursor.svg";
import { Button } from "@/components/ui/button";
import {
Select,
@@ -40,7 +41,6 @@ import {
isVideoWallpaperSource,
} from "@/lib/wallpapers";
import { type AspectRatio } from "@/utils/aspectRatioUtils";
-import minimalCursorUrl from "@/assets/cursors/custom/minimal-cursor.svg";
import { useI18n, useScopedT } from "../../contexts/I18nContext";
import type { AppLocale } from "../../i18n/config";
import { SUPPORTED_LOCALES } from "../../i18n/config";
@@ -60,6 +60,7 @@ import type {
AutoCaptionSettings,
CaptionCue,
CropRegion,
+ CursorClickEffectStyle,
CursorStyle,
EditorEffectSection,
FigureData,
@@ -76,6 +77,10 @@ import {
DEFAULT_CROP_REGION,
DEFAULT_CURSOR_CLICK_BOUNCE,
DEFAULT_CURSOR_CLICK_BOUNCE_DURATION,
+ DEFAULT_CURSOR_CLICK_EFFECT,
+ DEFAULT_CURSOR_CLICK_EFFECT_DURATION_MS,
+ DEFAULT_CURSOR_CLICK_EFFECT_OPACITY,
+ DEFAULT_CURSOR_CLICK_EFFECT_SCALE,
DEFAULT_CURSOR_MOTION_BLUR,
DEFAULT_CURSOR_SIZE,
DEFAULT_CURSOR_STYLE,
@@ -277,7 +282,11 @@ function ExtensionSettingsSection({
<div key={field.id} className="mt-1">
<SliderControl
label={field.label}
- value={typeof value === "number" ? value : (field.defaultValue as number)}
+ value={
+ typeof value === "number"
+ ? value
+ : (field.defaultValue as number)
+ }
defaultValue={field.defaultValue as number}
min={field.min ?? 0}
max={field.max ?? 1}
@@ -388,6 +397,33 @@ function ExtensionSettingsSection({
const MOTION_PRESET_ORDER: CursorMotionPresetId[] = ["focused", "smooth"];
+const CURSOR_CLICK_EFFECT_OPTIONS: Array<{
+ id: CursorClickEffectStyle;
+ label: string;
+ description: string;
+}> = [
+ {
+ id: "none",
+ label: "Off",
+ description: "No click animation. Keeps the pointer steady on every tap.",
+ },
+ {
+ id: "ripple",
+ label: "Ripple",
+ description: "Concentric rings that expand from the click point.",
+ },
+ {
+ id: "spotlight",
+ label: "Spotlight",
+ description: "A soft pulse that blooms behind the cursor on click.",
+ },
+ {
+ id: "burst",
+ label: "Burst",
+ description: "A sharper burst with sparks for more energetic demos.",
+ },
+];
+
function MotionPresetCards({
title,
activePresetId,
@@ -446,6 +482,157 @@ function MotionPresetCards({
);
}
+function CursorClickEffectPreview({ effect }: { effect: CursorClickEffectStyle }) {
+ return (
+ <div
+ className="relative flex items-center justify-center"
+ style={{
+ width: `${BUILTIN_CURSOR_PREVIEW_FRAME_SIZE}px`,
+ height: `${BUILTIN_CURSOR_PREVIEW_FRAME_SIZE}px`,
+ }}
+ >
+ {effect === "none" ? (
+ <div className="relative flex h-10 w-10 items-center justify-center">
+ <span className="absolute h-7 w-7 rounded-full border border-foreground/12" />
+ <span className="absolute h-px w-8 -rotate-12 rounded-full bg-foreground/35" />
+ </div>
+ ) : null}
+ {effect === "ripple" ? (
+ <svg
+ className="absolute h-12 w-12 text-[#2563EB]"
+ viewBox="0 0 48 48"
+ aria-hidden="true"
+ >
+ <circle
+ cx="24"
+ cy="24"
+ r="13"
+ fill="none"
+ stroke="currentColor"
+ strokeWidth="2"
+ opacity="0.72"
+ />
+ </svg>
+ ) : null}
+ {effect === "spotlight" ? (
+ <>
+ <span className="absolute h-12 w-12 rounded-full bg-[#2563EB]/18 blur-[8px]" />
+ <span className="absolute h-9 w-9 rounded-full bg-[#2563EB]/10" />
+ <span className="absolute h-7 w-7 rounded-full border-[1.5px] border-[#2563EB]/42" />
+ </>
+ ) : null}
+ {effect === "burst" ? (
+ <svg
+ className="absolute h-12 w-12 text-[#2563EB]/90"
+ viewBox="0 0 48 48"
+ aria-hidden="true"
+ >
+ <g
+ fill="none"
+ stroke="currentColor"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ >
+ <circle cx="24" cy="24" r="8.5" strokeWidth="1.8" opacity="0.54" />
+ <path d="M24 7.5v6.5" strokeWidth="1.8" opacity="0.9" />
+ <path d="M24 34v6.5" strokeWidth="1.8" opacity="0.9" />
+ <path d="M7.5 24H14" strokeWidth="1.8" opacity="0.9" />
+ <path d="M34 24h6.5" strokeWidth="1.8" opacity="0.9" />
+ <path d="M12.3 12.3l4.6 4.6" strokeWidth="1.7" opacity="0.82" />
+ <path d="M31.1 31.1l4.6 4.6" strokeWidth="1.7" opacity="0.82" />
+ <path d="M35.7 12.3l-4.6 4.6" strokeWidth="1.7" opacity="0.82" />
+ <path d="M16.9 31.1l-4.6 4.6" strokeWidth="1.7" opacity="0.82" />
+ </g>
+ </svg>
+ ) : null}
+ </div>
+ );
+}
+
+function CursorClickEffectCards({
+ title,
+ activeEffectId,
+ onApply,
+ showAdvanced,
+ onToggleAdvanced,
+ tSettings,
+}: {
+ title: string;
+ activeEffectId: CursorClickEffectStyle;
+ onApply: (effectId: CursorClickEffectStyle) => void;
+ showAdvanced: boolean;
+ onToggleAdvanced: () => void;
+ tSettings: (key: string, fallback?: string) => string;
+}) {
+ return (
+ <div className="flex flex-col gap-2">
+ <div className="flex items-center justify-between">
+ <div className="text-[10px] text-muted-foreground">{title}</div>
+ <button
+ type="button"
+ onClick={onToggleAdvanced}
+ aria-pressed={showAdvanced}
+ className="text-[10px] text-[#2563EB] transition-opacity hover:opacity-80"
+ title={
+ showAdvanced
+ ? tSettings(
+ "effects.cursorClickEffects.advancedHide",
+ "Hide advanced click effect controls",
+ )
+ : tSettings(
+ "effects.cursorClickEffects.advancedShow",
+ "Show advanced click effect controls",
+ )
+ }
+ >
+ {tSettings("effects.cursorClickEffects.advanced", "Advanced")}
+ </button>
+ </div>
+ <ToggleGroup
+ type="single"
+ value={activeEffectId}
+ onValueChange={(value) => {
+ if (value) {
+ onApply(value as CursorClickEffectStyle);
+ }
+ }}
+ className="grid grid-cols-4 gap-2"
+ aria-label={title}
+ >
+ {CURSOR_CLICK_EFFECT_OPTIONS.map((effect) => {
+ const label = tSettings(
+ `effects.cursorClickEffects.${effect.id}.label`,
+ effect.label,
+ );
+ const description = tSettings(
+ `effects.cursorClickEffects.${effect.id}.description`,
+ effect.description,
+ );
+
+ return (
+ <ToggleGroupItem
+ key={effect.id}
+ value={effect.id}
+ aria-label={label}
+ title={`${label} - ${description}`}
+ className={cn(
+ "group aspect-square h-auto min-w-0 rounded-[10px] border border-foreground/10 bg-foreground/[0.03] p-3 text-left text-foreground shadow-none transition-all hover:border-foreground/20 hover:bg-foreground/[0.06]",
+ "data-[state=on]:border-[#2563EB]/70 data-[state=on]:bg-[#2563EB]/12 data-[state=on]:text-foreground",
+ )}
+ >
+ <div className="flex h-full flex-col items-center justify-between gap-3">
+ <div className="flex min-h-0 flex-1 items-center justify-center rounded-lg px-2 py-1.5">
+ <CursorClickEffectPreview effect={effect.id} />
+ </div>
+ </div>
+ </ToggleGroupItem>
+ );
+ })}
+ </ToggleGroup>
+ </div>
+ );
+}
+
interface SettingsPanelProps {
panelMode?: "editor" | "background";
activeEffectSection?: EditorEffectSection;
@@ -534,6 +721,14 @@ interface SettingsPanelProps {
onZoomClassicModeChange?: (enabled: boolean) => void;
cursorMotionBlur?: number;
onCursorMotionBlurChange?: (amount: number) => void;
+ cursorClickEffect?: CursorClickEffectStyle;
+ onCursorClickEffectChange?: (effect: CursorClickEffectStyle) => void;
+ cursorClickEffectScale?: number;
+ onCursorClickEffectScaleChange?: (scale: number) => void;
+ cursorClickEffectOpacity?: number;
+ onCursorClickEffectOpacityChange?: (opacity: number) => void;
+ cursorClickEffectDurationMs?: number;
+ onCursorClickEffectDurationMsChange?: (duration: number) => void;
cursorClickBounce?: number;
onCursorClickBounceChange?: (amount: number) => void;
cursorClickBounceDuration?: number;
@@ -790,9 +985,13 @@ async function createInvertedPreview(url: string) {
function CursorStylePreview({
style,
previewUrls,
+ frameSize = BUILTIN_CURSOR_PREVIEW_FRAME_SIZE,
+ previewSize,
}: {
style: CursorStyle;
previewUrls: Partial<Record<string, string>>;
+ frameSize?: number;
+ previewSize?: number;
}) {
const previewSrc =
style === "macos"
@@ -806,13 +1005,14 @@ function CursorStylePreview({
: previewUrls[style];
if (style === "macos" || style === "tahoe" || style === "tahoe-inverted") {
- const previewSize = BUILTIN_CURSOR_PREVIEW_SIZE * getCursorStyleSizeMultiplier(style);
+ const resolvedPreviewSize =
+ (previewSize ?? BUILTIN_CURSOR_PREVIEW_SIZE) * getCursorStyleSizeMultiplier(style);
return (
<div
className="flex items-center justify-center"
style={{
- width: `${BUILTIN_CURSOR_PREVIEW_FRAME_SIZE}px`,
- height: `${BUILTIN_CURSOR_PREVIEW_FRAME_SIZE}px`,
+ width: `${frameSize}px`,
+ height: `${frameSize}px`,
}}
>
<img
@@ -821,8 +1021,8 @@ function CursorStylePreview({
className="max-w-none object-contain drop-shadow-[0_8px_12px_rgba(15,23,42,0.18)]"
draggable={false}
style={{
- width: `${previewSize}px`,
- height: `${previewSize}px`,
+ width: `${resolvedPreviewSize}px`,
+ height: `${resolvedPreviewSize}px`,
}}
/>
</div>
@@ -830,22 +1030,58 @@ function CursorStylePreview({
}
if (style === "figma") {
- return <img src={previewSrc} alt="" className="h-7 w-7 object-contain" draggable={false} />;
+ const resolvedPreviewSize = previewSize ?? 28;
+ return (
+ <div
+ className="flex items-center justify-center"
+ style={{ width: `${frameSize}px`, height: `${frameSize}px` }}
+ >
+ <img
+ src={previewSrc}
+ alt=""
+ className="object-contain"
+ draggable={false}
+ style={{
+ width: `${resolvedPreviewSize}px`,
+ height: `${resolvedPreviewSize}px`,
+ }}
+ />
+ </div>
+ );
}
if (style === "dot") {
+ const resolvedPreviewSize = previewSize ?? 14;
return (
- <span className="h-[14px] w-[14px] rounded-full border-[2.5px] border-neutral-800 bg-white shadow-[0_8px_12px_rgba(15,23,42,0.16)]" />
+ <div
+ className="flex items-center justify-center"
+ style={{ width: `${frameSize}px`, height: `${frameSize}px` }}
+ >
+ <span
+ className="rounded-full border-[2.5px] border-neutral-800 bg-white shadow-[0_8px_12px_rgba(15,23,42,0.16)]"
+ style={{
+ width: `${resolvedPreviewSize}px`,
+ height: `${resolvedPreviewSize}px`,
+ }}
+ />
+ </div>
);
}
+ const resolvedPreviewSize = previewSize ?? 28;
return (
- <img
- src={previewSrc ?? tahoeCursorUrl}
- alt=""
- className="h-7 w-7 object-contain"
- draggable={false}
- />
+ <div
+ className="flex items-center justify-center"
+ style={{ width: `${frameSize}px`, height: `${frameSize}px` }}
+ >
+ <img
+ src={previewSrc ?? tahoeCursorUrl}
+ alt=""
+ className="object-contain"
+ draggable={false}
+ style={{ width: `${resolvedPreviewSize}px`, height: `${resolvedPreviewSize}px` }}
+ />
+ </div>
);
}
@@ -919,6 +1155,14 @@ export function SettingsPanel({
onZoomClassicModeChange,
cursorMotionBlur = DEFAULT_CURSOR_MOTION_BLUR,
onCursorMotionBlurChange,
+ cursorClickEffect = DEFAULT_CURSOR_CLICK_EFFECT,
+ onCursorClickEffectChange,
+ cursorClickEffectScale = DEFAULT_CURSOR_CLICK_EFFECT_SCALE,
+ onCursorClickEffectScaleChange,
+ cursorClickEffectOpacity = DEFAULT_CURSOR_CLICK_EFFECT_OPACITY,
+ onCursorClickEffectOpacityChange,
+ cursorClickEffectDurationMs = DEFAULT_CURSOR_CLICK_EFFECT_DURATION_MS,
+ onCursorClickEffectDurationMsChange,
cursorClickBounce = 1,
onCursorClickBounceChange,
cursorClickBounceDuration = DEFAULT_CURSOR_CLICK_BOUNCE_DURATION,
@@ -1164,6 +1408,7 @@ export function SettingsPanel({
const [extensionCursorPreviewUrls, setExtensionCursorPreviewUrls] = useState<
Partial<Record<string, string>>
>({});
+ const [showCursorClickEffectAdvanced, setShowCursorClickEffectAdvanced] = useState(false);
const cursorPreviewUrls = useMemo(
() => ({ ...builtInCursorPreviewUrls, ...extensionCursorPreviewUrls }),
[builtInCursorPreviewUrls, extensionCursorPreviewUrls],
@@ -1241,12 +1486,7 @@ export function SettingsPanel({
if (!isKnownWallpaper && isVideoWallpaperSource(selected)) {
setCustomImages((prev) => (prev.includes(selected) ? prev : [selected, ...prev]));
}
- }, [
- builtInWallpaperPaths,
- extensionWallpaperPaths,
- selected,
- wallpaperPreviewPaths,
- ]);
+ }, [builtInWallpaperPaths, extensionWallpaperPaths, selected, wallpaperPreviewPaths]);
const imageWallpaperTiles = useMemo<WallpaperTile[]>(() => {
const imageWallpapers = builtInWallpapers.filter(
@@ -1534,8 +1774,12 @@ export function SettingsPanel({
);
onCursorSpringMassMultiplierChange?.(initialEditorPreferences.cursorSpringMassMultiplier);
onCursorMotionBlurChange?.(initialEditorPreferences.cursorMotionBlur);
+ onCursorClickEffectChange?.(initialEditorPreferences.cursorClickEffect);
+ onCursorClickEffectScaleChange?.(initialEditorPreferences.cursorClickEffectScale);
+ onCursorClickEffectOpacityChange?.(initialEditorPreferences.cursorClickEffectOpacity);
+ onCursorClickEffectDurationMsChange?.(initialEditorPreferences.cursorClickEffectDurationMs);
onCursorClickBounceChange?.(initialEditorPreferences.cursorClickBounce);
- onCursorClickBounceDurationChange?.(DEFAULT_CURSOR_CLICK_BOUNCE_DURATION);
+ onCursorClickBounceDurationChange?.(initialEditorPreferences.cursorClickBounceDuration);
onCursorSwayChange?.(initialEditorPreferences.cursorSway);
};
@@ -3069,8 +3313,8 @@ export function SettingsPanel({
</section>
);
- const audioSectionContent = (
- <section className="flex flex-col gap-3">
+ const audioSectionContent = (
+ <section className="flex flex-col gap-3">
<div className="flex items-center justify-between gap-3">
<SectionLabel>{tSettings("audio.volumeTitle", "Audio")}</SectionLabel>
<button
@@ -3084,8 +3328,8 @@ export function SettingsPanel({
{t("common.actions.reset", "Reset")}
</button>
</div>
- <SliderControl
- label={tSettings("audio.volume", "Volume")}
+ <SliderControl
+ label={tSettings("audio.volume", "Volume")}
value={selectedAudioVolume ?? 1}
defaultValue={1}
min={0}
@@ -3093,20 +3337,20 @@ export function SettingsPanel({
step={0.01}
onChange={(v) => onAudioVolumeChange?.(v)}
formatValue={(v) => `${Math.round(v * 100)}%`}
- parseInput={(text) => parseFloat(text.replace(/%$/, "")) / 100}
+ parseInput={(text) => parseFloat(text.replace(/%$/, "")) / 100}
+ />
+ <div className="flex items-center justify-between rounded-lg bg-foreground/[0.03] px-2.5 py-1.5">
+ <span className="text-[10px] text-muted-foreground">
+ {tSettings("audio.normalize", "Normalize")}
+ </span>
+ <Switch
+ checked={Boolean(selectedAudioNormalize)}
+ onCheckedChange={(v) => onAudioNormalizeChange?.(v)}
+ className="data-[state=checked]:bg-[#2563EB] scale-75"
/>
- <div className="flex items-center justify-between rounded-lg bg-foreground/[0.03] px-2.5 py-1.5">
- <span className="text-[10px] text-muted-foreground">
- {tSettings("audio.normalize", "Normalize")}
- </span>
- <Switch
- checked={Boolean(selectedAudioNormalize)}
- onCheckedChange={(v) => onAudioNormalizeChange?.(v)}
- className="data-[state=checked]:bg-[#2563EB] scale-75"
- />
- </div>
- </section>
- );
+ </div>
+ </section>
+ );
const clipSectionContent = (
<section className="flex flex-col gap-2">
@@ -3183,7 +3427,10 @@ export function SettingsPanel({
{hasClipSourceAudio && (
<div className="flex items-center justify-between rounded-lg bg-foreground/[0.03] px-2.5 py-1.5">
<span className="text-[10px] text-muted-foreground">
- {tSettings("clip.separateClipFromAudio", "Separate clip from audio")}
+ {tSettings(
+ "clip.separateClipFromAudio",
+ "Separate clip from audio",
+ )}
</span>
<Switch
checked={selectedClipShowSourceAudio ?? false}
@@ -3194,65 +3441,68 @@ export function SettingsPanel({
)}
</div>
- {selectedClipId &&
- hasClipSourceAudio &&
- sourceAudioTrackMeta.length > 0 && (
- <div className="mt-1 flex flex-col gap-3">
- {sourceAudioTrackMeta.map((track) => {
- const settings = sourceAudioTrackSettings[track.id] ?? {
- volume: 1,
- normalize: false,
- };
- return (
- <div
- key={track.id}
- className="rounded-lg border border-foreground/10 bg-foreground/[0.03] px-3 py-2"
- >
- <div className="mb-2 flex items-center justify-between">
- <span className="text-[11px] font-medium text-foreground">
- {track.label}
- </span>
- <button
- type="button"
- onClick={() => {
- onSourceAudioTrackVolumeChange?.(track.id, 1);
- onSourceAudioTrackNormalizeChange?.(track.id, false);
- }}
- className="text-[10px] text-[#2563EB] transition-opacity hover:opacity-80"
- >
- {t("common.actions.reset", "Reset")}
- </button>
- </div>
- <div className="mb-2 flex items-center justify-between rounded-lg bg-foreground/[0.03] px-2.5 py-1.5">
- <span className="text-[10px] text-muted-foreground">
- {tSettings("audio.normalize", "Normalize")}
- </span>
- <Switch
- checked={settings.normalize}
- onCheckedChange={(v) =>
- onSourceAudioTrackNormalizeChange?.(track.id, v)
- }
- className="data-[state=checked]:bg-[#06b6d4] scale-75"
- />
- </div>
- <SliderControl
- label={tSettings("audio.volume", "Volume")}
- value={settings.volume}
- defaultValue={1}
- min={0}
- max={1}
- step={0.01}
- onChange={(v) => onSourceAudioTrackVolumeChange?.(track.id, v)}
- formatValue={(v) => `${Math.round(v * 100)}%`}
- parseInput={(text) =>
- parseFloat(text.replace(/%$/, "")) / 100
+ {selectedClipId && hasClipSourceAudio && sourceAudioTrackMeta.length > 0 && (
+ <div className="mt-1 flex flex-col gap-3">
+ {sourceAudioTrackMeta.map((track) => {
+ const settings = sourceAudioTrackSettings[track.id] ?? {
+ volume: 1,
+ normalize: false,
+ };
+ return (
+ <div
+ key={track.id}
+ className="rounded-lg border border-foreground/10 bg-foreground/[0.03] px-3 py-2"
+ >
+ <div className="mb-2 flex items-center justify-between">
+ <span className="text-[11px] font-medium text-foreground">
+ {track.label}
+ </span>
+ <button
+ type="button"
+ onClick={() => {
+ onSourceAudioTrackVolumeChange?.(track.id, 1);
+ onSourceAudioTrackNormalizeChange?.(
+ track.id,
+ false,
+ );
+ }}
+ className="text-[10px] text-[#2563EB] transition-opacity hover:opacity-80"
+ >
+ {t("common.actions.reset", "Reset")}
+ </button>
+ </div>
+ <div className="mb-2 flex items-center justify-between rounded-lg bg-foreground/[0.03] px-2.5 py-1.5">
+ <span className="text-[10px] text-muted-foreground">
+ {tSettings("audio.normalize", "Normalize")}
+ </span>
+ <Switch
+ checked={settings.normalize}
+ onCheckedChange={(v) =>
+ onSourceAudioTrackNormalizeChange?.(track.id, v)
}
+ className="data-[state=checked]:bg-[#06b6d4] scale-75"
/>
</div>
- );
- })}
- </div>
- )}
+ <SliderControl
+ label={tSettings("audio.volume", "Volume")}
+ value={settings.volume}
+ defaultValue={1}
+ min={0}
+ max={1}
+ step={0.01}
+ onChange={(v) =>
+ onSourceAudioTrackVolumeChange?.(track.id, v)
+ }
+ formatValue={(v) => `${Math.round(v * 100)}%`}
+ parseInput={(text) =>
+ parseFloat(text.replace(/%$/, "")) / 100
+ }
+ />
+ </div>
+ );
+ })}
+ </div>
+ )}
</section>
);
@@ -3366,6 +3616,69 @@ export function SettingsPanel({
formatValue={(v) => `${v.toFixed(2)}×`}
parseInput={(text) => parseFloat(text.replace(/×$/, ""))}
/>
+ <CursorClickEffectCards
+ title={tSettings(
+ "effects.cursorClickEffects.title",
+ "Click Effects",
+ )}
+ activeEffectId={cursorClickEffect}
+ onApply={(effectId) => onCursorClickEffectChange?.(effectId)}
+ showAdvanced={showCursorClickEffectAdvanced}
+ onToggleAdvanced={() =>
+ setShowCursorClickEffectAdvanced((current) => !current)
+ }
+ tSettings={tSettings}
+ />
+ {showCursorClickEffectAdvanced ? (
+ <div className="grid gap-1.5">
+ <SliderControl
+ label={tSettings(
+ "effects.cursorClickEffects.size",
+ "Effect Size",
+ )}
+ value={cursorClickEffectScale}
+ defaultValue={DEFAULT_CURSOR_CLICK_EFFECT_SCALE}
+ min={0.5}
+ max={2}
+ step={0.05}
+ onChange={(v) => onCursorClickEffectScaleChange?.(v)}
+ formatValue={(v) => `${v.toFixed(2)}×`}
+ parseInput={(text) => parseFloat(text.replace(/×$/, ""))}
+ />
+ <SliderControl
+ label={tSettings(
+ "effects.cursorClickEffects.opacity",
+ "Effect Opacity",
+ )}
+ value={cursorClickEffectOpacity}
+ defaultValue={DEFAULT_CURSOR_CLICK_EFFECT_OPACITY}
+ min={0}
+ max={1}
+ step={0.01}
+ onChange={(v) => onCursorClickEffectOpacityChange?.(v)}
+ formatValue={(v) => `${Math.round(v * 100)}%`}
+ parseInput={(text) =>
+ parseFloat(text.replace(/%$/, "")) / 100
+ }
+ />
+ <SliderControl
+ label={tSettings(
+ "effects.cursorClickEffects.duration",
+ "Effect Duration",
+ )}
+ value={cursorClickEffectDurationMs}
+ defaultValue={DEFAULT_CURSOR_CLICK_EFFECT_DURATION_MS}
+ min={120}
+ max={1200}
+ step={10}
+ onChange={(v) => onCursorClickEffectDurationMsChange?.(v)}
+ formatValue={(v) => `${Math.round(v)} ms`}
+ parseInput={(text) =>
+ parseFloat(text.replace(/ms$/i, "").trim())
+ }
+ />
+ </div>
+ ) : null}
<SliderControl
label={tSettings("effects.cursorClickBounce")}
value={cursorClickBounce}
diff --git a/src/components/video-editor/VideoEditor.tsx b/src/components/video-editor/VideoEditor.tsx
index 4050189e..0a6d46ca 100644
--- a/src/components/video-editor/VideoEditor.tsx
+++ b/src/components/video-editor/VideoEditor.tsx
@@ -171,6 +171,7 @@ import {
type CaptionCue,
type ClipRegion,
type CropRegion,
+ type CursorClickEffectStyle,
type CursorStyle,
type CursorTelemetryPoint,
clampFocusToDepth,
@@ -184,6 +185,7 @@ import {
DEFAULT_CONNECTED_ZOOM_EASING,
DEFAULT_CONNECTED_ZOOM_GAP_MS,
DEFAULT_CROP_REGION,
+ DEFAULT_CURSOR_CLICK_EFFECT,
DEFAULT_CURSOR_STYLE,
DEFAULT_FIGURE_DATA,
DEFAULT_WEBCAM_OVERLAY,
@@ -464,6 +466,18 @@ export default function VideoEditor() {
const [cursorMotionBlur, setCursorMotionBlur] = useState(
initialEditorPreferences.cursorMotionBlur,
);
+ const [cursorClickEffect, setCursorClickEffect] = useState<CursorClickEffectStyle>(
+ initialEditorPreferences.cursorClickEffect,
+ );
+ const [cursorClickEffectScale, setCursorClickEffectScale] = useState(
+ initialEditorPreferences.cursorClickEffectScale,
+ );
+ const [cursorClickEffectOpacity, setCursorClickEffectOpacity] = useState(
+ initialEditorPreferences.cursorClickEffectOpacity,
+ );
+ const [cursorClickEffectDurationMs, setCursorClickEffectDurationMs] = useState(
+ initialEditorPreferences.cursorClickEffectDurationMs,
+ );
const [cursorClickBounce, setCursorClickBounce] = useState(
initialEditorPreferences.cursorClickBounce,
);
@@ -696,6 +710,10 @@ export default function VideoEditor() {
cameraSpringDampingMultiplier,
cameraSpringMassMultiplier,
cursorMotionBlur,
+ cursorClickEffect,
+ cursorClickEffectScale,
+ cursorClickEffectOpacity,
+ cursorClickEffectDurationMs,
cursorClickBounce,
cursorClickBounceDuration,
cursorSway,
@@ -747,6 +765,10 @@ export default function VideoEditor() {
cameraSpringDampingMultiplier,
cameraSpringMassMultiplier,
cursorMotionBlur,
+ cursorClickEffect,
+ cursorClickEffectScale,
+ cursorClickEffectOpacity,
+ cursorClickEffectDurationMs,
cursorClickBounce,
cursorClickBounceDuration,
cursorSway,
@@ -839,6 +861,10 @@ export default function VideoEditor() {
setCameraSpringDampingMultiplier(snapshot.cameraSpringDampingMultiplier);
setCameraSpringMassMultiplier(snapshot.cameraSpringMassMultiplier);
setCursorMotionBlur(snapshot.cursorMotionBlur);
+ setCursorClickEffect(snapshot.cursorClickEffect);
+ setCursorClickEffectScale(snapshot.cursorClickEffectScale);
+ setCursorClickEffectOpacity(snapshot.cursorClickEffectOpacity);
+ setCursorClickEffectDurationMs(snapshot.cursorClickEffectDurationMs);
setCursorClickBounce(snapshot.cursorClickBounce);
setCursorClickBounceDuration(snapshot.cursorClickBounceDuration);
setCursorSway(snapshot.cursorSway);
@@ -1111,6 +1137,10 @@ export default function VideoEditor() {
zoomSmoothness,
zoomClassicMode,
cursorMotionBlur,
+ cursorClickEffect,
+ cursorClickEffectScale,
+ cursorClickEffectOpacity,
+ cursorClickEffectDurationMs,
cursorClickBounce,
cursorClickBounceDuration,
cursorSway,
@@ -1180,6 +1210,10 @@ export default function VideoEditor() {
currentTime,
cursorClickBounce,
cursorClickBounceDuration,
+ cursorClickEffect,
+ cursorClickEffectScale,
+ cursorClickEffectOpacity,
+ cursorClickEffectDurationMs,
cursorMotionBlur,
cursorSize,
cursorSmoothing,
@@ -1569,6 +1603,9 @@ export default function VideoEditor() {
zoomSmoothness: number;
zoomClassicMode: boolean;
cursorMotionBlur: number;
+ cursorClickEffectScale: number;
+ cursorClickEffectOpacity: number;
+ cursorClickEffectDurationMs: number;
cursorClickBounce: number;
cursorClickBounceDuration: number;
cursorSway: number;
@@ -1672,6 +1709,10 @@ export default function VideoEditor() {
zoomSmoothness,
zoomClassicMode,
cursorMotionBlur,
+ cursorClickEffect,
+ cursorClickEffectScale,
+ cursorClickEffectOpacity,
+ cursorClickEffectDurationMs,
cursorClickBounce,
cursorClickBounceDuration,
cursorSway,
@@ -1734,6 +1775,10 @@ export default function VideoEditor() {
zoomSmoothness,
zoomClassicMode,
cursorMotionBlur,
+ cursorClickEffect,
+ cursorClickEffectScale,
+ cursorClickEffectOpacity,
+ cursorClickEffectDurationMs,
cursorClickBounce,
cursorClickBounceDuration,
cursorSway,
@@ -1915,6 +1960,10 @@ export default function VideoEditor() {
setCameraSpringStiffnessMultiplier(normalizedEditor.cameraSpringStiffnessMultiplier);
setCameraSpringDampingMultiplier(normalizedEditor.cameraSpringDampingMultiplier);
setCameraSpringMassMultiplier(normalizedEditor.cameraSpringMassMultiplier);
+ setCursorClickEffect(normalizedEditor.cursorClickEffect);
+ setCursorClickEffectScale(normalizedEditor.cursorClickEffectScale);
+ setCursorClickEffectOpacity(normalizedEditor.cursorClickEffectOpacity);
+ setCursorClickEffectDurationMs(normalizedEditor.cursorClickEffectDurationMs);
setZoomSmoothness(normalizedEditor.zoomSmoothness);
setZoomClassicMode(normalizedEditor.zoomClassicMode);
setCursorMotionBlur(normalizedEditor.cursorMotionBlur);
@@ -2415,6 +2464,10 @@ export default function VideoEditor() {
cameraSpringDampingMultiplier,
cameraSpringMassMultiplier,
cursorMotionBlur,
+ cursorClickEffect,
+ cursorClickEffectScale,
+ cursorClickEffectOpacity,
+ cursorClickEffectDurationMs,
cursorClickBounce,
cursorClickBounceDuration,
cursorSway,
@@ -2466,6 +2519,10 @@ export default function VideoEditor() {
cameraSpringDampingMultiplier,
cameraSpringMassMultiplier,
cursorMotionBlur,
+ cursorClickEffect,
+ cursorClickEffectScale,
+ cursorClickEffectOpacity,
+ cursorClickEffectDurationMs,
cursorClickBounce,
cursorClickBounceDuration,
cursorSway,
@@ -4108,6 +4165,10 @@ export default function VideoEditor() {
zoomSmoothness,
zoomClassicMode,
cursorMotionBlur,
+ cursorClickEffect,
+ cursorClickEffectScale,
+ cursorClickEffectOpacity,
+ cursorClickEffectDurationMs,
cursorClickBounce,
cursorClickBounceDuration,
cursorSway,
@@ -4286,6 +4347,10 @@ export default function VideoEditor() {
zoomSmoothness,
zoomClassicMode,
cursorMotionBlur,
+ cursorClickEffect,
+ cursorClickEffectScale,
+ cursorClickEffectOpacity,
+ cursorClickEffectDurationMs,
cursorClickBounce,
cursorClickBounceDuration,
cursorSway,
@@ -4538,6 +4603,10 @@ export default function VideoEditor() {
zoomSmoothness,
zoomClassicMode,
cursorMotionBlur,
+ cursorClickEffect,
+ cursorClickEffectScale,
+ cursorClickEffectOpacity,
+ cursorClickEffectDurationMs,
cursorClickBounce,
cursorClickBounceDuration,
cursorSway,
@@ -5678,6 +5747,14 @@ export default function VideoEditor() {
onZoomClassicModeChange={setZoomClassicMode}
cursorMotionBlur={cursorMotionBlur}
onCursorMotionBlurChange={setCursorMotionBlur}
+ cursorClickEffect={cursorClickEffect}
+ onCursorClickEffectChange={setCursorClickEffect}
+ cursorClickEffectScale={cursorClickEffectScale}
+ onCursorClickEffectScaleChange={setCursorClickEffectScale}
+ cursorClickEffectOpacity={cursorClickEffectOpacity}
+ onCursorClickEffectOpacityChange={setCursorClickEffectOpacity}
+ cursorClickEffectDurationMs={cursorClickEffectDurationMs}
+ onCursorClickEffectDurationMsChange={setCursorClickEffectDurationMs}
cursorClickBounce={cursorClickBounce}
onCursorClickBounceChange={setCursorClickBounce}
cursorClickBounceDuration={cursorClickBounceDuration}
@@ -5898,6 +5975,12 @@ export default function VideoEditor() {
zoomMotionBlur={zoomMotionBlur}
zoomMotionBlurTuning={zoomMotionBlurTuning}
cursorMotionBlur={cursorMotionBlur}
+ cursorClickEffect={cursorClickEffect}
+ cursorClickEffectScale={cursorClickEffectScale}
+ cursorClickEffectOpacity={cursorClickEffectOpacity}
+ cursorClickEffectDurationMs={
+ cursorClickEffectDurationMs
+ }
cursorClickBounce={cursorClickBounce}
cursorClickBounceDuration={
cursorClickBounceDuration
diff --git a/src/components/video-editor/VideoPlayback.tsx b/src/components/video-editor/VideoPlayback.tsx
index c64e6b42..63446f3f 100644
--- a/src/components/video-editor/VideoPlayback.tsx
+++ b/src/components/video-editor/VideoPlayback.tsx
@@ -36,6 +36,7 @@ import {
type AnnotationRegion,
type AutoCaptionSettings,
type CaptionCue,
+ type CursorClickEffectStyle,
type CursorStyle,
type Padding,
type SpeedRegion,
@@ -133,10 +134,14 @@ import {
DEFAULT_CONNECTED_ZOOM_GAP_MS,
DEFAULT_CURSOR_CLICK_BOUNCE,
DEFAULT_CURSOR_CLICK_BOUNCE_DURATION,
+ DEFAULT_CURSOR_CLICK_EFFECT,
+ DEFAULT_CURSOR_CLICK_EFFECT_DURATION_MS,
+ DEFAULT_CURSOR_CLICK_EFFECT_OPACITY,
+ DEFAULT_CURSOR_CLICK_EFFECT_SCALE,
DEFAULT_CURSOR_MOTION_BLUR,
DEFAULT_CURSOR_SIZE,
- DEFAULT_CURSOR_STYLE,
DEFAULT_CURSOR_SMOOTHING,
+ DEFAULT_CURSOR_STYLE,
DEFAULT_CURSOR_SWAY,
DEFAULT_PADDING,
DEFAULT_WEBCAM_CORNER_RADIUS,
@@ -209,7 +214,10 @@ const PIXI_RENDERER_INIT_TIMEOUT_MS = 8_000;
function isCanvasRenderer(application: Application): boolean {
const rendererName = application?.renderer?.constructor?.name?.toLowerCase();
- return Boolean(rendererName && (rendererName.includes("canvasrenderer") || rendererName.includes("canvas")));
+ return Boolean(
+ rendererName &&
+ (rendererName.includes("canvasrenderer") || rendererName.includes("canvas")),
+ );
}
function toRendererErrorMessage(error: unknown): string {
@@ -218,7 +226,10 @@ function toRendererErrorMessage(error: unknown): string {
function isRendererUnavailableError(error: unknown): boolean {
const message = toRendererErrorMessage(error).toLowerCase();
- return message.includes("canvasrenderer is not yet implemented") || message.includes("no available renderer");
+ return (
+ message.includes("canvasrenderer is not yet implemented") ||
+ message.includes("no available renderer")
+ );
}
function summarizeRendererAttempts(attempts: readonly PixiRendererAttempt[]): string {
@@ -366,6 +377,10 @@ interface VideoPlaybackProps {
zoomMotionBlur?: number;
zoomMotionBlurTuning?: ZoomMotionBlurTuning;
cursorMotionBlur?: number;
+ cursorClickEffect?: CursorClickEffectStyle;
+ cursorClickEffectScale?: number;
+ cursorClickEffectOpacity?: number;
+ cursorClickEffectDurationMs?: number;
cursorClickBounce?: number;
cursorClickBounceDuration?: number;
cursorSway?: number;
@@ -444,6 +459,10 @@ const VideoPlayback = forwardRef<VideoPlaybackRef, VideoPlaybackProps>(
zoomMotionBlur = DEFAULT_ZOOM_MOTION_BLUR,
zoomMotionBlurTuning = DEFAULT_ZOOM_MOTION_BLUR_TUNING,
cursorMotionBlur = DEFAULT_CURSOR_MOTION_BLUR,
+ cursorClickEffect = DEFAULT_CURSOR_CLICK_EFFECT,
+ cursorClickEffectScale = DEFAULT_CURSOR_CLICK_EFFECT_SCALE,
+ cursorClickEffectOpacity = DEFAULT_CURSOR_CLICK_EFFECT_OPACITY,
+ cursorClickEffectDurationMs = DEFAULT_CURSOR_CLICK_EFFECT_DURATION_MS,
cursorClickBounce = DEFAULT_CURSOR_CLICK_BOUNCE,
cursorClickBounceDuration = DEFAULT_CURSOR_CLICK_BOUNCE_DURATION,
cursorSway = DEFAULT_CURSOR_SWAY,
@@ -513,6 +532,8 @@ const VideoPlayback = forwardRef<VideoPlaybackRef, VideoPlaybackProps>(
y: number;
width: number;
height: number;
+ renderWidth?: number;
+ renderHeight?: number;
sourceCrop?: {
x: number;
y: number;
@@ -564,6 +585,10 @@ const VideoPlayback = forwardRef<VideoPlaybackRef, VideoPlaybackProps>(
const cameraSpringDampingMultiplierRef = useRef(cameraSpringDampingMultiplier);
const cameraSpringMassMultiplierRef = useRef(cameraSpringMassMultiplier);
const cursorMotionBlurRef = useRef(cursorMotionBlur);
+ const cursorClickEffectRef = useRef(cursorClickEffect);
+ const cursorClickEffectScaleRef = useRef(cursorClickEffectScale);
+ const cursorClickEffectOpacityRef = useRef(cursorClickEffectOpacity);
+ const cursorClickEffectDurationMsRef = useRef(cursorClickEffectDurationMs);
const cursorClickBounceRef = useRef(cursorClickBounce);
const cursorClickBounceDurationRef = useRef(cursorClickBounceDuration);
const cursorSwayRef = useRef(cursorSway);
@@ -583,7 +608,9 @@ const VideoPlayback = forwardRef<VideoPlaybackRef, VideoPlaybackProps>(
);
const initializePixiRenderer = useCallback(
- async (container: HTMLDivElement): Promise<{
+ async (
+ container: HTMLDivElement,
+ ): Promise<{
app: Application;
backend: PixiPreviewBackend;
}> => {
@@ -603,7 +630,8 @@ const VideoPlayback = forwardRef<VideoPlaybackRef, VideoPlaybackProps>(
}
const rendererApp = new Application();
- const initStarted = typeof performance === "undefined" ? Date.now() : performance.now();
+ const initStarted =
+ typeof performance === "undefined" ? Date.now() : performance.now();
try {
await initApplicationWithTimeout(
rendererApp,
@@ -622,7 +650,8 @@ const VideoPlayback = forwardRef<VideoPlaybackRef, VideoPlaybackProps>(
backend,
);
const elapsed = Math.round(
- (typeof performance === "undefined" ? Date.now() : performance.now()) - initStarted,
+ (typeof performance === "undefined" ? Date.now() : performance.now()) -
+ initStarted,
);
if (isCanvasRenderer(rendererApp)) {
throw new Error(
@@ -632,9 +661,13 @@ const VideoPlayback = forwardRef<VideoPlaybackRef, VideoPlaybackProps>(
return { app: rendererApp, backend };
} catch (error) {
const elapsed = Math.round(
- (typeof performance === "undefined" ? Date.now() : performance.now()) - initStarted,
+ (typeof performance === "undefined" ? Date.now() : performance.now()) -
+ initStarted,
);
- attempts.push({ backend, message: `${toRendererErrorMessage(error)} (after ${elapsed}ms)` });
+ attempts.push({
+ backend,
+ message: `${toRendererErrorMessage(error)} (after ${elapsed}ms)`,
+ });
const statusMessage = isRendererUnavailableError(error)
? "renderer backend unavailable in this runtime"
: "renderer init failed";
@@ -950,7 +983,12 @@ const VideoPlayback = forwardRef<VideoPlaybackRef, VideoPlaybackProps>(
videoSizeRef.current = result.videoSize;
baseScaleRef.current = result.baseScale;
baseOffsetRef.current = result.baseOffset;
- baseMaskRef.current = result.maskRect;
+ const renderResolution = app.renderer.resolution || window.devicePixelRatio || 1;
+ baseMaskRef.current = {
+ ...result.maskRect,
+ renderWidth: result.maskRect.width * renderResolution,
+ renderHeight: result.maskRect.height * renderResolution,
+ };
cropBoundsRef.current = result.cropBounds;
// Sync extension cursor effects canvas resolution with renderer
@@ -1061,7 +1099,9 @@ const VideoPlayback = forwardRef<VideoPlaybackRef, VideoPlaybackProps>(
const activeFrameData = frame
? extensionHost.getFrames().find((registeredFrame) => registeredFrame.id === frame)
: null;
- const shouldRedrawDynamicFrame = Boolean(activeFrameData?.draw && frameSpriteRef.current);
+ const shouldRedrawDynamicFrame = Boolean(
+ activeFrameData?.draw && frameSpriteRef.current,
+ );
// Layout-only changes should not force texture/sprite recreation.
if (frameReloadKeyRef.current === nextFrameReloadKey && !shouldRedrawDynamicFrame) {
@@ -1575,6 +1615,22 @@ const VideoPlayback = forwardRef<VideoPlaybackRef, VideoPlaybackProps>(
cursorMotionBlurRef.current = cursorMotionBlur;
}, [cursorMotionBlur]);
+ useEffect(() => {
+ cursorClickEffectRef.current = cursorClickEffect;
+ }, [cursorClickEffect]);
+
+ useEffect(() => {
+ cursorClickEffectScaleRef.current = cursorClickEffectScale;
+ }, [cursorClickEffectScale]);
+
+ useEffect(() => {
+ cursorClickEffectOpacityRef.current = cursorClickEffectOpacity;
+ }, [cursorClickEffectOpacity]);
+
+ useEffect(() => {
+ cursorClickEffectDurationMsRef.current = cursorClickEffectDurationMs;
+ }, [cursorClickEffectDurationMs]);
+
useEffect(() => {
cursorClickBounceRef.current = cursorClickBounce;
}, [cursorClickBounce]);
@@ -1873,6 +1929,10 @@ const VideoPlayback = forwardRef<VideoPlaybackRef, VideoPlaybackProps>(
massMultiplier: cursorSpringMassMultiplierRef.current,
},
motionBlur: cursorMotionBlurRef.current,
+ clickEffect: cursorClickEffectRef.current,
+ clickEffectScale: cursorClickEffectScaleRef.current,
+ clickEffectOpacity: cursorClickEffectOpacityRef.current,
+ clickEffectDurationMs: cursorClickEffectDurationMsRef.current,
clickBounce: cursorClickBounceRef.current,
clickBounceDuration: cursorClickBounceDurationRef.current,
sway: cursorSwayRef.current,
@@ -2236,10 +2296,7 @@ const VideoPlayback = forwardRef<VideoPlaybackRef, VideoPlaybackProps>(
resetSpringState(springYRef.current, appliedY);
}
- applyTransform(
- { scale: appliedScale, x: appliedX, y: appliedY },
- targetFocus,
- );
+ applyTransform({ scale: appliedScale, x: appliedX, y: appliedY }, targetFocus);
applyWebcamBubbleLayout(animationStateRef.current.appliedScale || 1);
@@ -2459,6 +2516,10 @@ const VideoPlayback = forwardRef<VideoPlaybackRef, VideoPlaybackProps>(
massMultiplier: cursorSpringMassMultiplier,
});
overlay.setMotionBlur(cursorMotionBlur);
+ overlay.setClickEffect(cursorClickEffect);
+ overlay.setClickEffectScale(cursorClickEffectScale);
+ overlay.setClickEffectOpacity(cursorClickEffectOpacity);
+ overlay.setClickEffectDurationMs(cursorClickEffectDurationMs);
overlay.setClickBounce(cursorClickBounce);
overlay.setClickBounceDuration(cursorClickBounceDuration);
overlay.setSway(cursorSway);
@@ -2490,6 +2551,10 @@ const VideoPlayback = forwardRef<VideoPlaybackRef, VideoPlaybackProps>(
cursorSpringDampingMultiplier,
cursorSpringMassMultiplier,
cursorMotionBlur,
+ cursorClickEffect,
+ cursorClickEffectScale,
+ cursorClickEffectOpacity,
+ cursorClickEffectDurationMs,
cursorClickBounce,
cursorClickBounceDuration,
cursorSway,
@@ -2742,7 +2807,7 @@ const VideoPlayback = forwardRef<VideoPlaybackRef, VideoPlaybackProps>(
filter:
showShadow && shadowIntensity > 0
? `drop-shadow(0 ${shadowIntensity * 12}px ${shadowIntensity * 48}px rgba(0,0,0,${shadowIntensity * 0.7})) drop-shadow(0 ${shadowIntensity * 4}px ${shadowIntensity * 16}px rgba(0,0,0,${shadowIntensity * 0.5})) drop-shadow(0 ${shadowIntensity * 2}px ${shadowIntensity * 8}px rgba(0,0,0,${shadowIntensity * 0.3}))`
- : "none",
+ : "none",
}}
/>
{hasRendererFallback && (
@@ -2750,7 +2815,8 @@ const VideoPlayback = forwardRef<VideoPlaybackRef, VideoPlaybackProps>(
<div className="rounded-md bg-black/70 px-3 py-1.5 text-xs text-white">
{`Pixi renderer unavailable on this environment (${pixiRendererBackend ?? "unknown"}).`}
<br />
- Fallback to 2D native preview so you can continue working while the GPU path is unavailable.
+ Fallback to 2D native preview so you can continue working while the GPU
+ path is unavailable.
</div>
</div>
)}
diff --git a/src/components/video-editor/editorPreferences.ts b/src/components/video-editor/editorPreferences.ts
index cbd41756..a65e9a6c 100644
--- a/src/components/video-editor/editorPreferences.ts
+++ b/src/components/video-editor/editorPreferences.ts
@@ -1,12 +1,12 @@
+import { loadAppSetting, saveAppSetting } from "../../lib/appSettings";
import {
normalizeExportBackendPreference,
normalizeExportMp4FrameRate,
normalizeExportPipelineModel,
normalizeProjectEditor,
- stripPersistedDevMotionBlurSettings,
type ProjectEditorState,
+ stripPersistedDevMotionBlurSettings,
} from "./projectPersistence";
-import { loadAppSetting, saveAppSetting } from "../../lib/appSettings";
type PersistedEditorControls = Pick<
ProjectEditorState,
@@ -39,6 +39,10 @@ type PersistedEditorControls = Pick<
| "cameraSpringDampingMultiplier"
| "cameraSpringMassMultiplier"
| "cursorMotionBlur"
+ | "cursorClickEffect"
+ | "cursorClickEffectScale"
+ | "cursorClickEffectOpacity"
+ | "cursorClickEffectDurationMs"
| "cursorClickBounce"
| "cursorClickBounceDuration"
| "cursorSway"
@@ -120,6 +124,10 @@ export const DEFAULT_EDITOR_PREFERENCES: EditorPreferences = {
cameraSpringDampingMultiplier: DEFAULT_EDITOR_CONTROLS.cameraSpringDampingMultiplier,
cameraSpringMassMultiplier: DEFAULT_EDITOR_CONTROLS.cameraSpringMassMultiplier,
cursorMotionBlur: DEFAULT_EDITOR_CONTROLS.cursorMotionBlur,
+ cursorClickEffect: DEFAULT_EDITOR_CONTROLS.cursorClickEffect,
+ cursorClickEffectScale: DEFAULT_EDITOR_CONTROLS.cursorClickEffectScale,
+ cursorClickEffectOpacity: DEFAULT_EDITOR_CONTROLS.cursorClickEffectOpacity,
+ cursorClickEffectDurationMs: DEFAULT_EDITOR_CONTROLS.cursorClickEffectDurationMs,
cursorClickBounce: DEFAULT_EDITOR_CONTROLS.cursorClickBounce,
cursorClickBounceDuration: DEFAULT_EDITOR_CONTROLS.cursorClickBounceDuration,
cursorSway: DEFAULT_EDITOR_CONTROLS.cursorSway,
@@ -279,14 +287,12 @@ function normalizeEditorControls(
zoomInDurationMs: sanitizedRaw.zoomInDurationMs ?? fallback.zoomInDurationMs,
zoomInOverlapMs: sanitizedRaw.zoomInOverlapMs ?? fallback.zoomInOverlapMs,
zoomOutDurationMs: sanitizedRaw.zoomOutDurationMs ?? fallback.zoomOutDurationMs,
- connectedZoomGapMs:
- sanitizedRaw.connectedZoomGapMs ?? fallback.connectedZoomGapMs,
+ connectedZoomGapMs: sanitizedRaw.connectedZoomGapMs ?? fallback.connectedZoomGapMs,
connectedZoomDurationMs:
sanitizedRaw.connectedZoomDurationMs ?? fallback.connectedZoomDurationMs,
zoomInEasing: sanitizedRaw.zoomInEasing ?? fallback.zoomInEasing,
zoomOutEasing: sanitizedRaw.zoomOutEasing ?? fallback.zoomOutEasing,
- connectedZoomEasing:
- sanitizedRaw.connectedZoomEasing ?? fallback.connectedZoomEasing,
+ connectedZoomEasing: sanitizedRaw.connectedZoomEasing ?? fallback.connectedZoomEasing,
showCursor: sanitizedRaw.showCursor ?? fallback.showCursor,
loopCursor: sanitizedRaw.loopCursor ?? fallback.loopCursor,
cursorStyle: sanitizedRaw.cursorStyle ?? fallback.cursorStyle,
@@ -296,19 +302,24 @@ function normalizeEditorControls(
sanitizedRaw.cursorSpringStiffnessMultiplier ??
fallback.cursorSpringStiffnessMultiplier,
cursorSpringDampingMultiplier:
- sanitizedRaw.cursorSpringDampingMultiplier ??
- fallback.cursorSpringDampingMultiplier,
+ sanitizedRaw.cursorSpringDampingMultiplier ?? fallback.cursorSpringDampingMultiplier,
cursorSpringMassMultiplier:
sanitizedRaw.cursorSpringMassMultiplier ?? fallback.cursorSpringMassMultiplier,
cameraSpringStiffnessMultiplier:
sanitizedRaw.cameraSpringStiffnessMultiplier ??
fallback.cameraSpringStiffnessMultiplier,
cameraSpringDampingMultiplier:
- sanitizedRaw.cameraSpringDampingMultiplier ??
- fallback.cameraSpringDampingMultiplier,
+ sanitizedRaw.cameraSpringDampingMultiplier ?? fallback.cameraSpringDampingMultiplier,
cameraSpringMassMultiplier:
sanitizedRaw.cameraSpringMassMultiplier ?? fallback.cameraSpringMassMultiplier,
cursorMotionBlur: sanitizedRaw.cursorMotionBlur ?? fallback.cursorMotionBlur,
+ cursorClickEffect: sanitizedRaw.cursorClickEffect ?? fallback.cursorClickEffect,
+ cursorClickEffectScale:
+ sanitizedRaw.cursorClickEffectScale ?? fallback.cursorClickEffectScale,
+ cursorClickEffectOpacity:
+ sanitizedRaw.cursorClickEffectOpacity ?? fallback.cursorClickEffectOpacity,
+ cursorClickEffectDurationMs:
+ sanitizedRaw.cursorClickEffectDurationMs ?? fallback.cursorClickEffectDurationMs,
cursorClickBounce: sanitizedRaw.cursorClickBounce ?? fallback.cursorClickBounce,
cursorClickBounceDuration:
sanitizedRaw.cursorClickBounceDuration ?? fallback.cursorClickBounceDuration,
@@ -318,8 +329,7 @@ function normalizeEditorControls(
frame: sanitizedRaw.frame !== undefined ? sanitizedRaw.frame : fallback.frame,
webcam: sanitizedRaw.webcam ?? fallback.webcam,
aspectRatio: sanitizedRaw.aspectRatio ?? fallback.aspectRatio,
- exportEncodingMode:
- sanitizedRaw.exportEncodingMode ?? fallback.exportEncodingMode,
+ exportEncodingMode: sanitizedRaw.exportEncodingMode ?? fallback.exportEncodingMode,
exportBackendPreference:
sanitizedRaw.exportBackendPreference === undefined
? fallback.exportBackendPreference
@@ -371,6 +381,10 @@ function normalizeEditorControls(
cameraSpringDampingMultiplier: normalized.cameraSpringDampingMultiplier,
cameraSpringMassMultiplier: normalized.cameraSpringMassMultiplier,
cursorMotionBlur: normalized.cursorMotionBlur,
+ cursorClickEffect: normalized.cursorClickEffect,
+ cursorClickEffectScale: normalized.cursorClickEffectScale,
+ cursorClickEffectOpacity: normalized.cursorClickEffectOpacity,
+ cursorClickEffectDurationMs: normalized.cursorClickEffectDurationMs,
cursorClickBounce: normalized.cursorClickBounce,
cursorClickBounceDuration: normalized.cursorClickBounceDuration,
cursorSway: normalized.cursorSway,
@@ -446,10 +460,7 @@ export function saveEditorPreferences(preferences: Partial<EditorPreferences>):
const merged = normalizeEditorPreferences({ ...current, ...preferences }, current);
const persisted = stripPersistedDevMotionBlurSettings(merged);
saveAppSetting(EDITOR_PREFERENCES_STORAGE_KEY, persisted);
- globalThis.localStorage?.setItem(
- EDITOR_PREFERENCES_STORAGE_KEY,
- JSON.stringify(persisted),
- );
+ globalThis.localStorage?.setItem(EDITOR_PREFERENCES_STORAGE_KEY, JSON.stringify(persisted));
} catch {
// Ignore storage failures so editor controls still work.
}
diff --git a/src/components/video-editor/projectPersistence.ts b/src/components/video-editor/projectPersistence.ts
index bb3d00df..2fcc34c8 100644
--- a/src/components/video-editor/projectPersistence.ts
+++ b/src/components/video-editor/projectPersistence.ts
@@ -1,3 +1,4 @@
+import type { SourceAudioTrackSettings } from "@/components/video-editor/audio/audioTypes";
import type {
ExportBackendPreference,
ExportEncodingMode,
@@ -20,7 +21,6 @@ import {
import { DEFAULT_WALLPAPER_PATH } from "@/lib/wallpapers";
import { ASPECT_RATIOS, type AspectRatio, isCustomAspectRatio } from "@/utils/aspectRatioUtils";
import { CURSOR_MOTION_PRESETS, resolveCursorMotionPresetId } from "./cursorMotionPresets";
-import type { SourceAudioTrackSettings } from "@/components/video-editor/audio/audioTypes";
import {
type AnnotationRegion,
type AudioRegion,
@@ -30,6 +30,7 @@ import {
type CaptionCueWord,
type ClipRegion,
type CropRegion,
+ type CursorClickEffectStyle,
type CursorStyle,
DEFAULT_ANNOTATION_POSITION,
DEFAULT_ANNOTATION_SIZE,
@@ -39,6 +40,10 @@ import {
DEFAULT_CONNECTED_ZOOM_EASING,
DEFAULT_CONNECTED_ZOOM_GAP_MS,
DEFAULT_CROP_REGION,
+ DEFAULT_CURSOR_CLICK_EFFECT,
+ DEFAULT_CURSOR_CLICK_EFFECT_DURATION_MS,
+ DEFAULT_CURSOR_CLICK_EFFECT_OPACITY,
+ DEFAULT_CURSOR_CLICK_EFFECT_SCALE,
DEFAULT_CURSOR_STYLE,
DEFAULT_CURSOR_SWAY,
DEFAULT_FIGURE_DATA,
@@ -62,6 +67,7 @@ import {
DEFAULT_ZOOM_OUT_EASING,
DEFAULT_ZOOM_SMOOTHNESS,
getDefaultCaptionFontFamily,
+ normalizeCursorClickEffectStyle,
type Padding,
type SpeedRegion,
type TrimRegion,
@@ -97,6 +103,10 @@ export interface ProjectEditorState {
showCursor: boolean;
loopCursor: boolean;
cursorStyle: CursorStyle;
+ cursorClickEffect: CursorClickEffectStyle;
+ cursorClickEffectScale: number;
+ cursorClickEffectOpacity: number;
+ cursorClickEffectDurationMs: number;
cursorSize: number;
cursorSmoothing: number;
cursorSpringStiffnessMultiplier: number;
@@ -163,10 +173,7 @@ type PersistedDevMotionBlurSettings = {
export function stripPersistedDevMotionBlurSettings<T extends PersistedDevMotionBlurSettings>(
editor: T,
): Omit<T, keyof PersistedDevMotionBlurSettings> {
- const {
- zoomMotionBlurTuning: _zoomMotionBlurTuning,
- ...persistedEditor
- } = editor;
+ const { zoomMotionBlurTuning: _zoomMotionBlurTuning, ...persistedEditor } = editor;
return persistedEditor;
}
@@ -669,17 +676,17 @@ export function normalizeProjectEditor(editor: Partial<ProjectEditorState>): Pro
const startMs = Math.max(0, Math.min(rawStart, rawEnd));
const endMs = Math.max(startMs + 1, rawEnd);
- return {
- id: region.id,
- startMs,
- endMs,
- audioPath: typeof region.audioPath === "string" ? region.audioPath : "",
- volume: isFiniteNumber(region.volume) ? clamp(region.volume, 0, 1) : 1,
- normalize: Boolean(region.normalize),
- trackIndex: isFiniteNumber(region.trackIndex)
- ? Math.max(0, Math.floor(region.trackIndex))
- : 0,
- };
+ return {
+ id: region.id,
+ startMs,
+ endMs,
+ audioPath: typeof region.audioPath === "string" ? region.audioPath : "",
+ volume: isFiniteNumber(region.volume) ? clamp(region.volume, 0, 1) : 1,
+ normalize: Boolean(region.normalize),
+ trackIndex: isFiniteNumber(region.trackIndex)
+ ? Math.max(0, Math.floor(region.trackIndex))
+ : 0,
+ };
})
: [];
@@ -854,6 +861,25 @@ export function normalizeProjectEditor(editor: Partial<ProjectEditorState>): Pro
)
: DEFAULT_MOTION_PRESET.cursorClickBounceDuration,
};
+ const normalizedCursorClickEffectScale = isFiniteNumber(
+ (editor as Partial<ProjectEditorState>).cursorClickEffectScale,
+ )
+ ? clamp((editor as Partial<ProjectEditorState>).cursorClickEffectScale as number, 0.5, 2)
+ : DEFAULT_CURSOR_CLICK_EFFECT_SCALE;
+ const normalizedCursorClickEffectOpacity = isFiniteNumber(
+ (editor as Partial<ProjectEditorState>).cursorClickEffectOpacity,
+ )
+ ? clamp((editor as Partial<ProjectEditorState>).cursorClickEffectOpacity as number, 0, 1)
+ : DEFAULT_CURSOR_CLICK_EFFECT_OPACITY;
+ const normalizedCursorClickEffectDurationMs = isFiniteNumber(
+ (editor as Partial<ProjectEditorState>).cursorClickEffectDurationMs,
+ )
+ ? clamp(
+ (editor as Partial<ProjectEditorState>).cursorClickEffectDurationMs as number,
+ 120,
+ 1200,
+ )
+ : DEFAULT_CURSOR_CLICK_EFFECT_DURATION_MS;
const normalizedMotionPreset =
CURSOR_MOTION_PRESETS[resolveCursorMotionPresetId(normalizedMotionValues)];
@@ -881,6 +907,13 @@ export function normalizeProjectEditor(editor: Partial<ProjectEditorState>): Pro
showCursor: typeof editor.showCursor === "boolean" ? editor.showCursor : true,
loopCursor: typeof editor.loopCursor === "boolean" ? editor.loopCursor : false,
cursorStyle: normalizedCursorStyle,
+ cursorClickEffect: normalizeCursorClickEffectStyle(
+ (editor as Partial<ProjectEditorState>).cursorClickEffect,
+ DEFAULT_CURSOR_CLICK_EFFECT,
+ ),
+ cursorClickEffectScale: normalizedCursorClickEffectScale,
+ cursorClickEffectOpacity: normalizedCursorClickEffectOpacity,
+ cursorClickEffectDurationMs: normalizedCursorClickEffectDurationMs,
cursorSize: normalizedMotionPreset.cursorSize,
cursorSmoothing: normalizedMotionPreset.cursorSmoothing,
cursorSpringStiffnessMultiplier: normalizedMotionPreset.cursorSpringStiffnessMultiplier,
diff --git a/src/components/video-editor/timeline/components/viewport/TimelineCanvas.tsx b/src/components/video-editor/timeline/components/viewport/TimelineCanvas.tsx
index 5f1a8a45..41e9dec2 100644
--- a/src/components/video-editor/timeline/components/viewport/TimelineCanvas.tsx
+++ b/src/components/video-editor/timeline/components/viewport/TimelineCanvas.tsx
@@ -62,9 +62,7 @@ interface TimelineCanvasProps {
onClearBlockSelection?: () => void;
keyframes?: { id: string; time: number }[];
sourceAudioTracks?: SourceAudioTrackWithPeaks[];
- getSourceAudioTrackSettingsForClip?: (
- clipId: string | null,
- ) => SourceAudioTrackSettings;
+ getSourceAudioTrackSettingsForClip?: (clipId: string | null) => SourceAudioTrackSettings;
showSourceAudioTrack?: boolean;
liveSpanPreviewById?: Record<string, { start: number; end: number }>;
liveHiddenItemIds?: string[];
@@ -103,7 +101,9 @@ function useTimelineHover({
(clientX: number, rect: DOMRect) => {
const contentWidth = Math.max(1, rect.width - sidebarWidth);
const contentX =
- direction === "rtl" ? rect.right - sidebarWidth - clientX : clientX - rect.left - sidebarWidth;
+ direction === "rtl"
+ ? rect.right - sidebarWidth - clientX
+ : clientX - rect.left - sidebarWidth;
const clampedX = Math.max(0, Math.min(contentX, contentWidth));
const ratio = clampedX / contentWidth;
const nextMs = rangeStart + ratio * visibleDurationMs;
@@ -194,7 +194,8 @@ function useTimelineHover({
: Math.max(ghostStartMs, Math.min(videoDurationMs, ghostStartMs + ghostDurationMs));
const ghostStartOffsetPx =
ghostStartMs === null ? 0 : valueToPixels(Math.max(0, ghostStartMs - rangeStart));
- const ghostEndOffsetPx = ghostEndMs === null ? 0 : valueToPixels(Math.max(0, ghostEndMs - rangeStart));
+ const ghostEndOffsetPx =
+ ghostEndMs === null ? 0 : valueToPixels(Math.max(0, ghostEndMs - rangeStart));
const ghostWidthPx = Math.max(18, ghostEndOffsetPx - ghostStartOffsetPx);
const timelineGhostOffsetPx =
timelineHoverMs === null ? 0 : valueToPixels(Math.max(0, timelineHoverMs - rangeStart));
@@ -235,9 +236,7 @@ interface TimelineCanvasRowsProps {
onSelectAnnotation?: (id: string | null) => void;
onSelectAudio?: (id: string | null) => void;
sourceAudioTracks?: SourceAudioTrackWithPeaks[];
- getSourceAudioTrackSettingsForClip?: (
- clipId: string | null,
- ) => SourceAudioTrackSettings;
+ getSourceAudioTrackSettingsForClip?: (clipId: string | null) => SourceAudioTrackSettings;
showSourceAudioTrack?: boolean;
liveSpanPreviewById?: Record<string, { start: number; end: number }>;
liveHiddenItemIds?: string[];
@@ -275,18 +274,18 @@ function AudioItemWithWaveform({
return { start: 0, end: duration };
}, [waveformSpan.end, waveformSpan.start]);
return (
- <Item
- id={item.id}
- rowId={item.rowId}
- span={span}
- isSelected={isSelected}
- onSelectId={onSelectAudio}
- variant="audio"
- waveformPeaks={peaks}
- waveformSegmentSpan={normalizedWaveformSpan}
- waveformGain={Math.max(0, Math.min(1, item.audioGain ?? 1))}
- waveformNormalize={Boolean(item.audioNormalize)}
- >
+ <Item
+ id={item.id}
+ rowId={item.rowId}
+ span={span}
+ isSelected={isSelected}
+ onSelectId={onSelectAudio}
+ variant="audio"
+ waveformPeaks={peaks}
+ waveformSegmentSpan={normalizedWaveformSpan}
+ waveformGain={Math.max(0, Math.min(1, item.audioGain ?? 1))}
+ waveformNormalize={Boolean(item.audioNormalize)}
+ >
{item.label}
</Item>
);
@@ -383,7 +382,7 @@ const TimelineCanvasRows = memo(function TimelineCanvasRows({
key={item.id}
rowId={item.rowId}
span={item.span}
- isSelected={selectAllBlocksActive || item.id === selectedClipId}
+ isSelected={item.id === selectedClipId}
onSelectId={onSelectClip}
variant="clip"
speedValue={item.speedValue}
@@ -397,30 +396,32 @@ const TimelineCanvasRows = memo(function TimelineCanvasRows({
{showSourceAudioTrack &&
sourceAudioTracks.map((track) => (
<Row key={track.id} id={`${SOURCE_AUDIO_ROW_ID}-${track.id}`}>
- {clipItems.filter(item => item.showSourceAudio).map((item) => {
- const settings = getSourceAudioTrackSettingsForClip?.(item.id)?.[
- track.id
- ] ?? { volume: 1, normalize: false };
- return (
- <Item
- key={`source-audio-${track.id}-${item.id}`}
- id={`source-audio-${track.id}-${item.id}`}
- rowId={`${SOURCE_AUDIO_ROW_ID}-${track.id}`}
- span={liveSpanPreviewById?.[item.id] ?? item.span}
- disabled
- isSelected={selectAllBlocksActive || item.id === selectedClipId}
- onSelect={() => onSelectClip?.(item.id)}
- variant="audio"
- waveformPeaks={track.peaks}
- waveformSegmentSpan={item.sourceSpan ?? item.span}
- waveformGain={Math.max(0, Math.min(1, settings.volume))}
- waveformNormalize={Boolean(settings.normalize)}
- muted={item.muted}
- >
- {track.label}
- </Item>
- );
- })}
+ {clipItems
+ .filter((item) => item.showSourceAudio)
+ .map((item) => {
+ const settings = getSourceAudioTrackSettingsForClip?.(item.id)?.[
+ track.id
+ ] ?? { volume: 1, normalize: false };
+ return (
+ <Item
+ key={`source-audio-${track.id}-${item.id}`}
+ id={`source-audio-${track.id}-${item.id}`}
+ rowId={`${SOURCE_AUDIO_ROW_ID}-${track.id}`}
+ span={liveSpanPreviewById?.[item.id] ?? item.span}
+ disabled
+ isSelected={item.id === selectedClipId}
+ onSelect={() => onSelectClip?.(item.id)}
+ variant="audio"
+ waveformPeaks={track.peaks}
+ waveformSegmentSpan={item.sourceSpan ?? item.span}
+ waveformGain={Math.max(0, Math.min(1, settings.volume))}
+ waveformNormalize={Boolean(settings.normalize)}
+ muted={item.muted}
+ >
+ {track.label}
+ </Item>
+ );
+ })}
</Row>
))}
@@ -439,8 +440,14 @@ const TimelineCanvasRows = memo(function TimelineCanvasRows({
className="absolute top-1/2 -translate-y-1/2 h-[85%] min-h-[22px]"
style={
direction === "rtl"
- ? { right: `${ghostStartOffsetPx}px`, width: `${ghostWidthPx}px` }
- : { left: `${ghostStartOffsetPx}px`, width: `${ghostWidthPx}px` }
+ ? {
+ right: `${ghostStartOffsetPx}px`,
+ width: `${ghostWidthPx}px`,
+ }
+ : {
+ left: `${ghostStartOffsetPx}px`,
+ width: `${ghostWidthPx}px`,
+ }
}
>
<div
@@ -461,31 +468,36 @@ const TimelineCanvasRows = memo(function TimelineCanvasRows({
{zoomItems
.filter((item) => !hiddenIds.has(item.id))
.map((item) => (
- <Item
- id={item.id}
- key={item.id}
- rowId={item.rowId}
- span={item.span}
- isSelected={selectAllBlocksActive || item.id === selectedZoomId}
- onSelectId={onSelectZoom}
- zoomDepth={item.zoomDepth}
- zoomMode={item.zoomMode}
- variant="zoom"
- >
- {item.label}
- </Item>
- ))}
+ <Item
+ id={item.id}
+ key={item.id}
+ rowId={item.rowId}
+ span={item.span}
+ isSelected={selectAllBlocksActive || item.id === selectedZoomId}
+ onSelectId={onSelectZoom}
+ zoomDepth={item.zoomDepth}
+ zoomMode={item.zoomMode}
+ variant="zoom"
+ >
+ {item.label}
+ </Item>
+ ))}
</Row>
{annotationRows.map(({ rowId, items: rowItems }, index) => (
- <Row key={rowId} id={rowId} isEmpty={rowItems.length === 0} hint={index === 0 ? HINT_ANNOTATION : undefined}>
+ <Row
+ key={rowId}
+ id={rowId}
+ isEmpty={rowItems.length === 0}
+ hint={index === 0 ? HINT_ANNOTATION : undefined}
+ >
{rowItems.map((item) => (
<Item
id={item.id}
key={item.id}
rowId={item.rowId}
span={item.span}
- isSelected={selectAllBlocksActive || item.id === selectedAnnotationId}
+ isSelected={item.id === selectedAnnotationId}
onSelectId={onSelectAnnotation}
variant="annotation"
>
@@ -496,14 +508,19 @@ const TimelineCanvasRows = memo(function TimelineCanvasRows({
))}
{audioRows.map(({ rowId, items: rowItems }, index) => (
- <Row key={rowId} id={rowId} isEmpty={rowItems.length === 0} hint={index === 0 ? HINT_AUDIO : undefined}>
+ <Row
+ key={rowId}
+ id={rowId}
+ isEmpty={rowItems.length === 0}
+ hint={index === 0 ? HINT_AUDIO : undefined}
+ >
{rowItems.map((item) => (
<AudioItemWithWaveform
key={item.id}
item={item}
span={item.span}
waveformSpan={liveSpanPreviewById?.[item.id] ?? item.span}
- isSelected={selectAllBlocksActive || item.id === selectedAudioId}
+ isSelected={item.id === selectedAudioId}
onSelectAudio={onSelectAudio}
/>
))}
@@ -607,7 +624,8 @@ export default function TimelineCanvas({
const handleTimelineMouseDown = useCallback(
(e: MouseEvent<HTMLDivElement>) => {
- if (e.button !== 0 || !onSeek || videoDurationMs <= 0 || !localTimelineRef.current) return;
+ if (e.button !== 0 || !onSeek || videoDurationMs <= 0 || !localTimelineRef.current)
+ return;
if ((e.target as HTMLElement).closest("[data-timeline-item]")) {
return;
}
@@ -643,7 +661,8 @@ export default function TimelineCanvas({
const flushSeek = () => {
seekRafRef.current = null;
- if (!onSeek || !localTimelineRef.current || pendingSeekClientXRef.current === null) return;
+ if (!onSeek || !localTimelineRef.current || pendingSeekClientXRef.current === null)
+ return;
const rect = localTimelineRef.current.getBoundingClientRect();
onSeek(getAbsoluteMsFromClientX(pendingSeekClientXRef.current, rect) / 1000);
};
@@ -748,14 +767,21 @@ export default function TimelineCanvas({
<div
className="absolute top-0 bottom-0 z-[45] pointer-events-none"
style={{
- [sideProperty === "right" ? "marginRight" : "marginLeft"]: `${sidebarWidth - 1}px`,
+ [sideProperty === "right" ? "marginRight" : "marginLeft"]:
+ `${sidebarWidth - 1}px`,
}}
>
- <div className="absolute top-0 bottom-0 w-px bg-foreground/35" style={{ [sideProperty]: `${timelineGhostOffsetPx}px` }} />
+ <div
+ className="absolute top-0 bottom-0 w-px bg-foreground/35"
+ style={{ [sideProperty]: `${timelineGhostOffsetPx}px` }}
+ />
</div>
)}
- <div className="relative z-10 flex flex-1 min-h-0 flex-col" style={{ minHeight: timelineRowsMinHeightPx }}>
+ <div
+ className="relative z-10 flex flex-1 min-h-0 flex-col"
+ style={{ minHeight: timelineRowsMinHeightPx }}
+ >
<TimelineCanvasRows
items={items}
videoDurationMs={videoDurationMs}
diff --git a/src/components/video-editor/timeline/hooks/useTimelineEditorRuntime.ts b/src/components/video-editor/timeline/hooks/useTimelineEditorRuntime.ts
index 15233f86..7cf3c162 100644
--- a/src/components/video-editor/timeline/hooks/useTimelineEditorRuntime.ts
+++ b/src/components/video-editor/timeline/hooks/useTimelineEditorRuntime.ts
@@ -1,13 +1,6 @@
import type { Span } from "dnd-timeline";
-import { useCallback, useImperativeHandle } from "react";
import type { ForwardedRef, RefObject } from "react";
-import type { TimelineShortcutBindings } from "../core/timelineTypes";
-import { useTimelineDndBindings } from "./useTimelineDndBindings";
-import { useTimelineAudioActions } from "./actions/useTimelineAudioActions";
-import { useTimelineKeyboardShortcuts } from "./useTimelineKeyboardShortcuts";
-import { useTimelineNormalization } from "./useTimelineNormalization";
-import { useTimelineSelection } from "./useTimelineSelection";
-import { useTimelineZoomActions } from "./actions/useTimelineZoomActions";
+import { useCallback, useImperativeHandle } from "react";
import type {
AnnotationRegion,
AudioRegion,
@@ -18,7 +11,14 @@ import type {
ZoomFocus,
ZoomRegion,
} from "../../types";
+import type { TimelineShortcutBindings } from "../core/timelineTypes";
import type { TimelineEditorHandle } from "../TimelineEditor";
+import { useTimelineAudioActions } from "./actions/useTimelineAudioActions";
+import { useTimelineZoomActions } from "./actions/useTimelineZoomActions";
+import { useTimelineDndBindings } from "./useTimelineDndBindings";
+import { useTimelineKeyboardShortcuts } from "./useTimelineKeyboardShortcuts";
+import { useTimelineNormalization } from "./useTimelineNormalization";
+import { useTimelineSelection } from "./useTimelineSelection";
interface UseTimelineEditorRuntimeParams {
ref: ForwardedRef<TimelineEditorHandle>;
@@ -113,7 +113,8 @@ export function useTimelineEditorRuntime({
setSelectedKeyframeId,
selectAllBlocksActive,
setSelectAllBlocksActive,
- hasAnyTimelineBlocks,
+ hasAnyZoomBlocks,
+ activateSelectAllZooms,
addKeyframe,
deleteSelectedKeyframe,
handleKeyframeMove,
@@ -122,7 +123,6 @@ export function useTimelineEditorRuntime({
deleteSelectedAnnotation,
deleteSelectedAudio,
clearSelectedBlocks,
- deleteAllBlocks,
handleSelectZoom,
handleSelectClip,
handleSelectAnnotation,
@@ -162,33 +162,43 @@ export function useTimelineEditorRuntime({
onAudioSpanChange,
});
- const { hasOverlap, timelineItems, allRegionSpans, getResolvedDropRowId, handleItemSpanChange } =
- useTimelineDndBindings({
- zoomRegions,
- trimRegions,
- clipRegions,
- annotationRegions,
- speedRegions,
- audioRegions,
- onZoomSpanChange,
- onTrimSpanChange,
- onClipSpanChange,
- onAnnotationSpanChange,
- onSpeedSpanChange,
- onAudioSpanChange,
- });
+ const {
+ hasOverlap,
+ timelineItems,
+ allRegionSpans,
+ getResolvedDropRowId,
+ handleItemSpanChange,
+ } = useTimelineDndBindings({
+ zoomRegions,
+ trimRegions,
+ clipRegions,
+ annotationRegions,
+ speedRegions,
+ audioRegions,
+ onZoomSpanChange,
+ onTrimSpanChange,
+ onClipSpanChange,
+ onAnnotationSpanChange,
+ onSpeedSpanChange,
+ onAudioSpanChange,
+ });
- const { defaultRegionDurationMs, canPlaceZoomAtMs, addZoomAtMs, handleAddZoom, handleSuggestZooms } =
- useTimelineZoomActions({
- timeline: { videoDuration, totalMs, currentTimeMs },
- regions: { zoom: zoomRegions, clip: clipRegions },
- cursorTelemetry,
- options: { disableSuggestedZooms },
- autoSuggestZoomsTrigger,
- onAutoSuggestZoomsConsumed,
- onZoomAdded,
- onZoomSuggested,
- });
+ const {
+ defaultRegionDurationMs,
+ canPlaceZoomAtMs,
+ addZoomAtMs,
+ handleAddZoom,
+ handleSuggestZooms,
+ } = useTimelineZoomActions({
+ timeline: { videoDuration, totalMs, currentTimeMs },
+ regions: { zoom: zoomRegions, clip: clipRegions },
+ cursorTelemetry,
+ options: { disableSuggestedZooms },
+ autoSuggestZoomsTrigger,
+ onAutoSuggestZoomsConsumed,
+ onZoomAdded,
+ onZoomSuggested,
+ });
const handleSplitClip = useCallback(() => {
if (!videoDuration || videoDuration === 0 || totalMs === 0 || !onClipSplit) {
@@ -226,7 +236,8 @@ export function useTimelineEditorRuntime({
isMac,
keyShortcuts,
isTimelineFocusedRef,
- hasAnyTimelineBlocks,
+ hasAnyZoomBlocks,
+ activateSelectAllZooms,
annotationCount: annotationRegions.length,
selectedKeyframeId,
selectedZoomId,
@@ -234,13 +245,10 @@ export function useTimelineEditorRuntime({
selectedAnnotationId,
selectedAudioId,
selectAllBlocksActive,
- setSelectAllBlocksActive,
- setSelectedKeyframeId,
addKeyframe,
handleAddZoom,
handleSplitClip,
handleAddAnnotation: () => handleAddAnnotation(),
- deleteAllBlocks,
deleteSelectedKeyframe,
deleteSelectedZoom,
deleteSelectedClip,
@@ -259,7 +267,14 @@ export function useTimelineEditorRuntime({
addAudio: handleAddAudio,
keyframes,
}),
- [handleAddAnnotation, handleAddAudio, handleAddZoom, handleSuggestZooms, handleSplitClip, keyframes],
+ [
+ handleAddAnnotation,
+ handleAddAudio,
+ handleAddZoom,
+ handleSuggestZooms,
+ handleSplitClip,
+ keyframes,
+ ],
);
return {
diff --git a/src/components/video-editor/timeline/hooks/useTimelineKeyboardShortcuts.ts b/src/components/video-editor/timeline/hooks/useTimelineKeyboardShortcuts.ts
index 55d2c0b6..ba1f5673 100644
--- a/src/components/video-editor/timeline/hooks/useTimelineKeyboardShortcuts.ts
+++ b/src/components/video-editor/timeline/hooks/useTimelineKeyboardShortcuts.ts
@@ -1,4 +1,4 @@
-import { useEffect, type RefObject } from "react";
+import { type RefObject, useEffect } from "react";
import { matchesShortcut } from "@/lib/shortcuts";
import type { TimelineShortcutBindings } from "../core/timelineTypes";
import { resolveDeleteSelectionTarget } from "./utils/timelineSelectionUtils";
@@ -7,7 +7,8 @@ interface UseTimelineKeyboardShortcutsParams {
isMac: boolean;
keyShortcuts: TimelineShortcutBindings;
isTimelineFocusedRef: RefObject<boolean>;
- hasAnyTimelineBlocks: boolean;
+ hasAnyZoomBlocks: boolean;
+ activateSelectAllZooms: () => void;
annotationCount: number;
selectedKeyframeId: string | null;
selectedZoomId: string | null;
@@ -15,13 +16,10 @@ interface UseTimelineKeyboardShortcutsParams {
selectedAnnotationId?: string | null;
selectedAudioId?: string | null;
selectAllBlocksActive: boolean;
- setSelectAllBlocksActive: (active: boolean) => void;
- setSelectedKeyframeId: (id: string | null) => void;
addKeyframe: () => void;
handleAddZoom: () => void;
handleSplitClip: () => void;
handleAddAnnotation: () => void;
- deleteAllBlocks: () => void;
deleteSelectedKeyframe: () => void;
deleteSelectedZoom: () => void;
deleteSelectedClip: () => void;
@@ -34,7 +32,8 @@ export function useTimelineKeyboardShortcuts({
isMac,
keyShortcuts,
isTimelineFocusedRef,
- hasAnyTimelineBlocks,
+ hasAnyZoomBlocks,
+ activateSelectAllZooms,
annotationCount,
selectedKeyframeId,
selectedZoomId,
@@ -42,13 +41,10 @@ export function useTimelineKeyboardShortcuts({
selectedAnnotationId,
selectedAudioId,
selectAllBlocksActive,
- setSelectAllBlocksActive,
- setSelectedKeyframeId,
addKeyframe,
handleAddZoom,
handleSplitClip,
handleAddAnnotation,
- deleteAllBlocks,
deleteSelectedKeyframe,
deleteSelectedZoom,
deleteSelectedClip,
@@ -73,12 +69,11 @@ export function useTimelineKeyboardShortcuts({
}
if (matchesShortcut(e, { key: "a", ctrl: true }, isMac)) {
- if (!hasAnyTimelineBlocks) {
+ if (!hasAnyZoomBlocks) {
return;
}
e.preventDefault();
- setSelectedKeyframeId(null);
- setSelectAllBlocksActive(true);
+ activateSelectAllZooms();
return;
}
@@ -111,9 +106,7 @@ export function useTimelineKeyboardShortcuts({
if (target !== "none") {
e.preventDefault();
}
- if (target === "all") {
- deleteAllBlocks();
- } else if (target === "keyframe") {
+ if (target === "keyframe") {
deleteSelectedKeyframe();
} else if (target === "zoom") {
deleteSelectedZoom();
@@ -130,10 +123,10 @@ export function useTimelineKeyboardShortcuts({
window.addEventListener("keydown", handleKeyDown);
return () => window.removeEventListener("keydown", handleKeyDown);
}, [
+ activateSelectAllZooms,
addKeyframe,
annotationCount,
cycleAnnotationsAtCurrentTime,
- deleteAllBlocks,
deleteSelectedAnnotation,
deleteSelectedAudio,
deleteSelectedClip,
@@ -142,7 +135,7 @@ export function useTimelineKeyboardShortcuts({
handleAddAnnotation,
handleAddZoom,
handleSplitClip,
- hasAnyTimelineBlocks,
+ hasAnyZoomBlocks,
isMac,
isTimelineFocusedRef,
keyShortcuts,
@@ -152,7 +145,5 @@ export function useTimelineKeyboardShortcuts({
selectedClipId,
selectedKeyframeId,
selectedZoomId,
- setSelectAllBlocksActive,
- setSelectedKeyframeId,
]);
}
diff --git a/src/components/video-editor/timeline/hooks/useTimelineSelection.ts b/src/components/video-editor/timeline/hooks/useTimelineSelection.ts
index 2d78162e..41a75095 100644
--- a/src/components/video-editor/timeline/hooks/useTimelineSelection.ts
+++ b/src/components/video-editor/timeline/hooks/useTimelineSelection.ts
@@ -46,6 +46,7 @@ export function useTimelineSelection({
const [keyframes, setKeyframes] = useState<{ id: string; time: number }[]>([]);
const [selectedKeyframeId, setSelectedKeyframeId] = useState<string | null>(null);
const [selectAllBlocksActive, setSelectAllBlocksActive] = useState(false);
+ const hasAnyZoomBlocks = useMemo(() => zoomRegions.length > 0, [zoomRegions.length]);
const addKeyframe = useCallback(() => {
if (totalMs === 0) return;
@@ -72,10 +73,29 @@ export function useTimelineSelection({
);
const deleteSelectedZoom = useCallback(() => {
- if (!selectedZoomId) return;
- onZoomDelete(selectedZoomId);
+ if (selectAllBlocksActive) {
+ zoomRegions.map((region) => region.id).forEach((id) => onZoomDelete(id));
+ } else if (selectedZoomId) {
+ onZoomDelete(selectedZoomId);
+ } else {
+ return;
+ }
+
onSelectZoom(null);
- }, [selectedZoomId, onZoomDelete, onSelectZoom]);
+ onSelectClip?.(null);
+ onSelectAnnotation?.(null);
+ onSelectAudio?.(null);
+ setSelectAllBlocksActive(false);
+ }, [
+ selectAllBlocksActive,
+ zoomRegions,
+ onZoomDelete,
+ selectedZoomId,
+ onSelectZoom,
+ onSelectClip,
+ onSelectAnnotation,
+ onSelectAudio,
+ ]);
const deleteSelectedClip = useCallback(() => {
if (!selectedClipId || !onClipDelete || !onSelectClip) return;
@@ -103,33 +123,14 @@ export function useTimelineSelection({
setSelectAllBlocksActive(false);
}, [onSelectZoom, onSelectClip, onSelectAnnotation, onSelectAudio]);
- const hasAnyTimelineBlocks = useMemo(
- () =>
- zoomRegions.length > 0 ||
- clipRegions.length > 0 ||
- annotationRegions.length > 0 ||
- audioRegions.length > 0,
- [zoomRegions.length, clipRegions.length, annotationRegions.length, audioRegions.length],
- );
-
- const deleteAllBlocks = useCallback(() => {
- zoomRegions.map((r) => r.id).forEach((id) => onZoomDelete(id));
- clipRegions.map((r) => r.id).forEach((id) => onClipDelete?.(id));
- annotationRegions.map((r) => r.id).forEach((id) => onAnnotationDelete?.(id));
- audioRegions.map((r) => r.id).forEach((id) => onAudioDelete?.(id));
- clearSelectedBlocks();
+ const activateSelectAllZooms = useCallback(() => {
+ onSelectZoom(null);
+ onSelectClip?.(null);
+ onSelectAnnotation?.(null);
+ onSelectAudio?.(null);
setSelectedKeyframeId(null);
- }, [
- zoomRegions,
- clipRegions,
- annotationRegions,
- audioRegions,
- onZoomDelete,
- onClipDelete,
- onAnnotationDelete,
- onAudioDelete,
- clearSelectedBlocks,
- ]);
+ setSelectAllBlocksActive(true);
+ }, [onSelectZoom, onSelectClip, onSelectAnnotation, onSelectAudio]);
const handleSelectZoom = useCallback(
(id: string | null) => {
@@ -193,7 +194,8 @@ export function useTimelineSelection({
setSelectedKeyframeId,
selectAllBlocksActive,
setSelectAllBlocksActive,
- hasAnyTimelineBlocks,
+ hasAnyZoomBlocks,
+ activateSelectAllZooms,
addKeyframe,
deleteSelectedKeyframe,
handleKeyframeMove,
@@ -202,7 +204,6 @@ export function useTimelineSelection({
deleteSelectedAnnotation,
deleteSelectedAudio,
clearSelectedBlocks,
- deleteAllBlocks,
handleSelectZoom,
handleSelectClip,
handleSelectAnnotation,
diff --git a/src/components/video-editor/timeline/hooks/utils/timelineSelectionUtils.test.ts b/src/components/video-editor/timeline/hooks/utils/timelineSelectionUtils.test.ts
index 3a93afde..c1e3289a 100644
--- a/src/components/video-editor/timeline/hooks/utils/timelineSelectionUtils.test.ts
+++ b/src/components/video-editor/timeline/hooks/utils/timelineSelectionUtils.test.ts
@@ -2,7 +2,7 @@ import { describe, expect, it } from "vitest";
import { resolveDeleteSelectionTarget } from "./timelineSelectionUtils";
describe("timelineSelectionUtils", () => {
- it("prioritizes select-all over any individual selection", () => {
+ it("treats zoom select-all as a zoom deletion target", () => {
expect(
resolveDeleteSelectionTarget({
selectAllBlocksActive: true,
@@ -12,7 +12,7 @@ describe("timelineSelectionUtils", () => {
selectedAnnotationId: "a-1",
selectedAudioId: "au-1",
}),
- ).toBe("all");
+ ).toBe("zoom");
});
it("follows selection priority order", () => {
diff --git a/src/components/video-editor/timeline/hooks/utils/timelineSelectionUtils.ts b/src/components/video-editor/timeline/hooks/utils/timelineSelectionUtils.ts
index ac2b1299..af4cb77d 100644
--- a/src/components/video-editor/timeline/hooks/utils/timelineSelectionUtils.ts
+++ b/src/components/video-editor/timeline/hooks/utils/timelineSelectionUtils.ts
@@ -1,11 +1,4 @@
-export type DeleteSelectionTarget =
- | "all"
- | "keyframe"
- | "zoom"
- | "clip"
- | "annotation"
- | "audio"
- | "none";
+export type DeleteSelectionTarget = "keyframe" | "zoom" | "clip" | "annotation" | "audio" | "none";
interface ResolveDeleteSelectionTargetParams {
selectAllBlocksActive: boolean;
@@ -24,7 +17,7 @@ export function resolveDeleteSelectionTarget({
selectedAnnotationId,
selectedAudioId,
}: ResolveDeleteSelectionTargetParams): DeleteSelectionTarget {
- if (selectAllBlocksActive) return "all";
+ if (selectAllBlocksActive) return "zoom";
if (selectedKeyframeId) return "keyframe";
if (selectedZoomId) return "zoom";
if (selectedClipId) return "clip";
diff --git a/src/components/video-editor/types.ts b/src/components/video-editor/types.ts
index b88f3d2e..7721738b 100644
--- a/src/components/video-editor/types.ts
+++ b/src/components/video-editor/types.ts
@@ -46,6 +46,10 @@ export interface CursorVisualSettings {
motionBlur: number;
clickBounce: number;
clickBounceDuration: number;
+ clickEffect: CursorClickEffectStyle;
+ clickEffectScale: number;
+ clickEffectOpacity: number;
+ clickEffectDurationMs: number;
sway: number;
style: CursorStyle;
}
@@ -53,6 +57,21 @@ export interface CursorVisualSettings {
export type CursorStyle = "macos" | "tahoe" | "tahoe-inverted" | "dot" | "figma" | (string & {}); // extension-contributed cursor styles
export const DEFAULT_CURSOR_STYLE: CursorStyle = "tahoe";
+export type CursorClickEffectStyle = "none" | "ripple" | "spotlight" | "burst";
+export const DEFAULT_CURSOR_CLICK_EFFECT: CursorClickEffectStyle = "ripple";
+export const DEFAULT_CURSOR_CLICK_EFFECT_SCALE = 1;
+export const DEFAULT_CURSOR_CLICK_EFFECT_OPACITY = 1;
+export const DEFAULT_CURSOR_CLICK_EFFECT_DURATION_MS = 600;
+
+export function normalizeCursorClickEffectStyle(
+ value: unknown,
+ fallback: CursorClickEffectStyle = DEFAULT_CURSOR_CLICK_EFFECT,
+): CursorClickEffectStyle {
+ return value === "none" || value === "ripple" || value === "spotlight" || value === "burst"
+ ? value
+ : fallback;
+}
+
export type EditorEffectSection =
| "scene"
| "cursor"
@@ -466,7 +485,10 @@ export const DEFAULT_PADDING: Padding = {
right: 20,
linked: true,
};
-export type { SourceAudioTrackSetting, SourceAudioTrackSettings } from "@/components/video-editor/audio/audioTypes";
+export type {
+ SourceAudioTrackSetting,
+ SourceAudioTrackSettings,
+} from "@/components/video-editor/audio/audioTypes";
export interface AudioRegion {
id: string;
diff --git a/src/components/video-editor/videoPlayback/cursorFollowCamera.test.ts b/src/components/video-editor/videoPlayback/cursorFollowCamera.test.ts
index 8493623a..cd66d111 100644
--- a/src/components/video-editor/videoPlayback/cursorFollowCamera.test.ts
+++ b/src/components/video-editor/videoPlayback/cursorFollowCamera.test.ts
@@ -107,4 +107,24 @@ describe("computeCursorFollowFocus", () => {
expect(clampedFocus).toEqual({ cx: 0.75, cy: 0.75 });
});
+
+ it("starts auto zooms from the saved region focus before following the cursor", () => {
+ const state = createCursorFollowCameraState();
+ const cursorSamples = [
+ { timeMs: 0, cx: 0.8, cy: 0.2, interactionType: "move" as const },
+ { timeMs: 100, cx: 0.82, cy: 0.22, interactionType: "move" as const },
+ ];
+
+ const initialFocus = computeCursorFollowFocus(
+ state,
+ cursorSamples,
+ 0,
+ 2,
+ 1,
+ { cx: 0.3, cy: 0.7 },
+ { snapToEdgesRatio: 0.25 },
+ );
+
+ expect(initialFocus).toEqual({ cx: 0.3, cy: 0.7 });
+ });
});
\ No newline at end of file
diff --git a/src/components/video-editor/videoPlayback/cursorFollowCamera.ts b/src/components/video-editor/videoPlayback/cursorFollowCamera.ts
index 75106a81..00635234 100644
--- a/src/components/video-editor/videoPlayback/cursorFollowCamera.ts
+++ b/src/components/video-editor/videoPlayback/cursorFollowCamera.ts
@@ -152,9 +152,11 @@ export function computeCursorFollowFocus(
const cursorPos = interpolateCursorPosition(cursorSamples, timeMs);
if (!cursorPos) {
- return state.initialized
- ? { cx: state.focusX, cy: state.focusY }
- : clampedRegionFocus;
+ if (state.initialized) {
+ return { cx: state.focusX, cy: state.focusY };
+ }
+
+ return clampedRegionFocus;
}
// Track when zoom reaches full strength
@@ -170,12 +172,7 @@ export function computeCursorFollowFocus(
const timeWentBackwards = state.initialized && timeMs + 0.5 < state.lastTimeMs;
if (!state.initialized || !state.wasZoomed || timeWentBackwards) {
- const initialFocus = recenterFocusWhenCursorLeavesSafeZone(
- clampedRegionFocus,
- { cx: cursorPos.cx, cy: cursorPos.cy },
- zoomScale,
- config.snapToEdgesRatio,
- );
+ const initialFocus = clampedRegionFocus;
state.lastTimeMs = timeMs;
state.initialized = true;
state.wasZoomed = true;
diff --git a/src/components/video-editor/videoPlayback/cursorRenderer.ts b/src/components/video-editor/videoPlayback/cursorRenderer.ts
index 644cf899..ed7070a7 100644
--- a/src/components/video-editor/videoPlayback/cursorRenderer.ts
+++ b/src/components/video-editor/videoPlayback/cursorRenderer.ts
@@ -4,9 +4,14 @@ import minimalCursorUrl from "@/assets/cursors/custom/minimal-cursor.svg";
import { getRenderableAssetUrl } from "@/lib/assetPath";
import { extensionHost } from "@/lib/extensions";
import {
+ type CursorClickEffectStyle,
type CursorStyle,
type CursorTelemetryPoint,
DEFAULT_CURSOR_CLICK_BOUNCE_DURATION,
+ DEFAULT_CURSOR_CLICK_EFFECT,
+ DEFAULT_CURSOR_CLICK_EFFECT_DURATION_MS,
+ DEFAULT_CURSOR_CLICK_EFFECT_OPACITY,
+ DEFAULT_CURSOR_CLICK_EFFECT_SCALE,
DEFAULT_CURSOR_STYLE,
} from "../types";
import { computeCursorSwayRotation } from "./cursorSway";
@@ -85,6 +90,14 @@ export interface CursorRenderConfig {
clickBounce: number;
/** Click bounce duration in milliseconds. */
clickBounceDuration: number;
+ /** Click effect graphics rendered around the pointer. */
+ clickEffect: CursorClickEffectStyle;
+ /** Click effect size multiplier. */
+ clickEffectScale: number;
+ /** Click effect opacity multiplier. */
+ clickEffectOpacity: number;
+ /** Click effect duration in milliseconds. */
+ clickEffectDurationMs: number;
/** Cursor sway multiplier. */
sway: number;
/** Cursor visual style. */
@@ -105,13 +118,16 @@ export const DEFAULT_CURSOR_CONFIG: CursorRenderConfig = {
motionBlur: 0,
clickBounce: 1,
clickBounceDuration: DEFAULT_CURSOR_CLICK_BOUNCE_DURATION,
+ clickEffect: DEFAULT_CURSOR_CLICK_EFFECT,
+ clickEffectScale: DEFAULT_CURSOR_CLICK_EFFECT_SCALE,
+ clickEffectOpacity: DEFAULT_CURSOR_CLICK_EFFECT_OPACITY,
+ clickEffectDurationMs: DEFAULT_CURSOR_CLICK_EFFECT_DURATION_MS,
sway: 0,
style: DEFAULT_CURSOR_STYLE,
};
const REFERENCE_WIDTH = 1920;
const MIN_CURSOR_VIEWPORT_SCALE = 0.55;
-const CLICK_RING_FADE_MS = 600;
const CURSOR_MOTION_BLUR_BASE_MULTIPLIER = 0.08;
const CURSOR_TIME_DISCONTINUITY_MS = 100;
const CURSOR_SWAY_SMOOTHING_MULTIPLIER = 0.7;
@@ -200,7 +216,7 @@ async function createCursorStyleAsset(style: SingleCursorStyle): Promise<LoadedC
const trimmed = trimCanvasToAlpha(sourceCanvas, { x: 40, y: 22 });
await Assets.load(trimmed.dataUrl);
const trimmedImage = await loadImage(trimmed.dataUrl);
- const texture = Texture.from(trimmed.dataUrl);
+ const texture = configureCursorTexture(Texture.from(trimmed.dataUrl));
return {
texture,
@@ -229,7 +245,7 @@ async function createCursorStyleAsset(style: SingleCursorStyle): Promise<LoadedC
const dataUrl = canvas.toDataURL("image/png");
await Assets.load(dataUrl);
const image = await loadImage(dataUrl);
- const texture = Texture.from(dataUrl);
+ const texture = configureCursorTexture(Texture.from(dataUrl));
return {
texture,
@@ -247,7 +263,7 @@ async function createCursorPackAsset(
const renderableUrl = await getRenderableAssetUrl(url);
await Assets.load(renderableUrl);
const image = await loadImage(renderableUrl);
- const texture = Texture.from(renderableUrl);
+ const texture = configureCursorTexture(Texture.from(renderableUrl));
return {
texture,
@@ -272,6 +288,12 @@ function clamp(value: number, min: number, max: number) {
return Math.min(max, Math.max(min, value));
}
+function configureCursorTexture(texture: Texture) {
+ texture.source.scaleMode = "linear";
+ texture.source.autoGenerateMipmaps = true;
+ return texture;
+}
+
function trimCanvasToAlpha(canvas: HTMLCanvasElement, hotspot?: { x: number; y: number }) {
const ctx = canvas.getContext("2d");
if (!ctx) {
@@ -367,7 +389,7 @@ async function createInvertedCursorAsset(asset: LoadedCursorAsset): Promise<Load
const dataUrl = canvas.toDataURL("image/png");
await Assets.load(dataUrl);
const image = await loadImage(dataUrl);
- const texture = Texture.from(dataUrl);
+ const texture = configureCursorTexture(Texture.from(dataUrl));
return {
texture,
@@ -479,7 +501,7 @@ export async function preloadCursorAssets() {
try {
await Assets.load(sourceAsset.url);
const image = await loadImage(sourceAsset.url);
- const texture = Texture.from(sourceAsset.url);
+ const texture = configureCursorTexture(Texture.from(sourceAsset.url));
return [
key,
@@ -742,13 +764,11 @@ function findLatestStableCursorType(samples: CursorTelemetryPoint[], timeMs: num
}
function getCursorViewportScale(viewport: CursorViewportRect) {
- return Math.max(MIN_CURSOR_VIEWPORT_SCALE, viewport.width / REFERENCE_WIDTH);
+ const renderWidth = viewport.renderWidth ?? viewport.width;
+ return Math.max(MIN_CURSOR_VIEWPORT_SCALE, renderWidth / REFERENCE_WIDTH);
}
-function getCursorSwaySpringConfig(
- smoothingFactor: number,
- springTuning: CursorSpringTuning,
-) {
+function getCursorSwaySpringConfig(smoothingFactor: number, springTuning: CursorSpringTuning) {
const baseConfig = getCursorSpringConfig(
Math.min(
2,
@@ -769,14 +789,177 @@ function getCursorSwaySpringConfig(
};
}
+function getClickEffectColor(interactionType?: CursorTelemetryPoint["interactionType"]) {
+ switch (interactionType) {
+ case "right-click":
+ return 0xf59e0b;
+ case "middle-click":
+ return 0xa855f7;
+ case "double-click":
+ return 0x22c55e;
+ default:
+ return 0x2563eb;
+ }
+}
+
+function getExtensionStyleRippleMetrics(
+ cursorSize: number,
+ clickProgress: number,
+ effectScale: number,
+ effectOpacity: number,
+) {
+ const eased = 1 - Math.pow(clickProgress, 3);
+ const fade = Math.pow(clickProgress, 3);
+
+ return {
+ radius: Math.max(0.5, eased * cursorSize * 1.95 * effectScale),
+ alpha: Math.max(0, Math.min(1, fade * 0.6 * effectOpacity)),
+ strokeWidth: Math.max(1, 2 * fade),
+ };
+}
+
+function drawClickEffectGraphics(
+ graphics: Graphics,
+ effect: CursorClickEffectStyle,
+ px: number,
+ py: number,
+ cursorSize: number,
+ clickProgress: number,
+ effectScale: number,
+ effectOpacity: number,
+ interactionType?: CursorTelemetryPoint["interactionType"],
+) {
+ graphics.clear();
+ if (effect === "none" || clickProgress <= 0) {
+ return;
+ }
+
+ const reveal = 1 - clickProgress;
+ const alpha = clickProgress * effectOpacity;
+ const color = getClickEffectColor(interactionType);
+ const baseRadius = Math.max(12, cursorSize * 0.55 * effectScale);
+ const strokeWidth = Math.max(2, cursorSize * 0.08);
+
+ if (effect === "ripple") {
+ const ripple = getExtensionStyleRippleMetrics(
+ cursorSize,
+ clickProgress,
+ effectScale,
+ effectOpacity,
+ );
+ graphics.circle(px, py, ripple.radius);
+ graphics.stroke({ width: ripple.strokeWidth, color, alpha: ripple.alpha });
+ return;
+ }
+
+ if (effect === "spotlight") {
+ const glowRadius = baseRadius + reveal * cursorSize * effectScale;
+ graphics.circle(px, py, glowRadius);
+ graphics.fill({ color, alpha: alpha * 0.16 });
+ graphics.circle(px, py, glowRadius * 0.78);
+ graphics.stroke({ width: Math.max(1.5, strokeWidth * 0.75), color, alpha: alpha * 0.5 });
+ return;
+ }
+
+ const burstRadius = baseRadius + reveal * cursorSize * 1.15 * effectScale;
+ graphics.circle(px, py, burstRadius * 0.78);
+ graphics.stroke({ width: strokeWidth, color, alpha: alpha * 0.7 });
+ for (let index = 0; index < 8; index += 1) {
+ const angle = (Math.PI * 2 * index) / 8 + reveal * 0.35;
+ const startRadius = burstRadius * 0.95;
+ const endRadius = burstRadius * 1.4;
+ graphics.moveTo(px + Math.cos(angle) * startRadius, py + Math.sin(angle) * startRadius);
+ graphics.lineTo(px + Math.cos(angle) * endRadius, py + Math.sin(angle) * endRadius);
+ }
+ graphics.stroke({ width: Math.max(1.25, strokeWidth * 0.58), color, alpha: alpha * 0.88 });
+}
+
+function drawClickEffectOnCanvas(
+ ctx: CanvasRenderingContext2D,
+ effect: CursorClickEffectStyle,
+ px: number,
+ py: number,
+ cursorSize: number,
+ clickProgress: number,
+ effectScale: number,
+ effectOpacity: number,
+ interactionType?: CursorTelemetryPoint["interactionType"],
+) {
+ if (effect === "none" || clickProgress <= 0) {
+ return;
+ }
+
+ const reveal = 1 - clickProgress;
+ const alpha = clickProgress * effectOpacity;
+ const color = getClickEffectColor(interactionType);
+ const strokeColor = `rgba(${(color >> 16) & 255}, ${(color >> 8) & 255}, ${color & 255}, `;
+ const baseRadius = Math.max(12, cursorSize * 0.55 * effectScale);
+ const strokeWidth = Math.max(2, cursorSize * 0.08);
+
+ ctx.save();
+
+ if (effect === "ripple") {
+ const ripple = getExtensionStyleRippleMetrics(
+ cursorSize,
+ clickProgress,
+ effectScale,
+ effectOpacity,
+ );
+ ctx.lineWidth = ripple.strokeWidth;
+ ctx.strokeStyle = `${strokeColor}${ripple.alpha.toFixed(3)})`;
+ ctx.beginPath();
+ ctx.arc(px, py, ripple.radius, 0, Math.PI * 2);
+ ctx.stroke();
+ ctx.restore();
+ return;
+ }
+
+ if (effect === "spotlight") {
+ const glowRadius = baseRadius + reveal * cursorSize * effectScale;
+ ctx.fillStyle = `${strokeColor}${(alpha * 0.16).toFixed(3)})`;
+ ctx.beginPath();
+ ctx.arc(px, py, glowRadius, 0, Math.PI * 2);
+ ctx.fill();
+ ctx.lineWidth = Math.max(1.5, strokeWidth * 0.75);
+ ctx.strokeStyle = `${strokeColor}${(alpha * 0.5).toFixed(3)})`;
+ ctx.beginPath();
+ ctx.arc(px, py, glowRadius * 0.78, 0, Math.PI * 2);
+ ctx.stroke();
+ ctx.restore();
+ return;
+ }
+
+ const burstRadius = baseRadius + reveal * cursorSize * 1.15 * effectScale;
+ ctx.lineWidth = strokeWidth;
+ ctx.strokeStyle = `${strokeColor}${(alpha * 0.7).toFixed(3)})`;
+ ctx.beginPath();
+ ctx.arc(px, py, burstRadius * 0.78, 0, Math.PI * 2);
+ ctx.stroke();
+ ctx.lineWidth = Math.max(1.25, strokeWidth * 0.58);
+ ctx.strokeStyle = `${strokeColor}${(alpha * 0.88).toFixed(3)})`;
+ ctx.beginPath();
+ for (let index = 0; index < 8; index += 1) {
+ const angle = (Math.PI * 2 * index) / 8 + reveal * 0.35;
+ const startRadius = burstRadius * 0.95;
+ const endRadius = burstRadius * 1.4;
+ ctx.moveTo(px + Math.cos(angle) * startRadius, py + Math.sin(angle) * startRadius);
+ ctx.lineTo(px + Math.cos(angle) * endRadius, py + Math.sin(angle) * endRadius);
+ }
+ ctx.stroke();
+ ctx.restore();
+}
+
function getCursorVisualState(
samples: CursorTelemetryPoint[],
timeMs: number,
clickBounceDuration: number,
+ clickEffectDurationMs: number,
) {
const latestClick = findLatestInteractionSample(samples, timeMs);
const interactionType = latestClick?.interactionType;
const ageMs = latestClick ? Math.max(0, timeMs - latestClick.timeMs) : Number.POSITIVE_INFINITY;
+ const clickEffectDelayMs = clickBounceDuration * 0.5;
+ const clickEffectAgeMs = ageMs - clickEffectDelayMs;
const isClickEvent =
interactionType === "click" ||
interactionType === "double-click" ||
@@ -789,10 +972,14 @@ function getCursorVisualState(
return {
cursorType: findLatestStableCursorType(samples, timeMs),
+ interactionType,
clickBounceProgress,
clickProgress:
- latestClick && isClickEvent && ageMs <= CLICK_RING_FADE_MS
- ? 1 - ageMs / CLICK_RING_FADE_MS
+ latestClick &&
+ isClickEvent &&
+ clickEffectAgeMs >= 0 &&
+ clickEffectAgeMs <= clickEffectDurationMs
+ ? 1 - clickEffectAgeMs / clickEffectDurationMs
: 0,
};
}
@@ -812,7 +999,9 @@ export class SmoothedCursorState {
private xSpring = createSpringState(0.5);
private ySpring = createSpringState(0.5);
- constructor(config: Pick<CursorRenderConfig, "smoothingFactor" | "trailLength" | "springTuning">) {
+ constructor(
+ config: Pick<CursorRenderConfig, "smoothingFactor" | "trailLength" | "springTuning">,
+ ) {
this.smoothingFactor = config.smoothingFactor;
this.springTuning = config.springTuning;
this.trailLength = config.trailLength;
@@ -1003,6 +1192,22 @@ export class PixiCursorOverlay {
this.config.clickBounce = Math.max(0, clickBounce);
}
+ setClickEffect(clickEffect: CursorClickEffectStyle) {
+ this.config.clickEffect = clickEffect;
+ }
+
+ setClickEffectScale(clickEffectScale: number) {
+ this.config.clickEffectScale = clamp(clickEffectScale, 0.5, 2);
+ }
+
+ setClickEffectOpacity(clickEffectOpacity: number) {
+ this.config.clickEffectOpacity = clamp(clickEffectOpacity, 0, 1);
+ }
+
+ setClickEffectDurationMs(clickEffectDurationMs: number) {
+ this.config.clickEffectDurationMs = clamp(clickEffectDurationMs, 120, 1200);
+ }
+
setClickBounceDuration(clickBounceDuration: number) {
this.config.clickBounceDuration = clamp(clickBounceDuration, 60, 500);
}
@@ -1108,11 +1313,13 @@ export class PixiCursorOverlay {
const px = viewport.x + this.state.x * viewport.width;
const py = viewport.y + this.state.y * viewport.height;
const h = this.config.dotRadius * getCursorViewportScale(viewport);
- const { cursorType, clickBounceProgress } = getCursorVisualState(
- samples,
- timeMs,
- this.config.clickBounceDuration,
- );
+ const { cursorType, interactionType, clickBounceProgress, clickProgress } =
+ getCursorVisualState(
+ samples,
+ timeMs,
+ this.config.clickBounceDuration,
+ this.config.clickEffectDurationMs,
+ );
const bounceScale = Math.max(
0.72,
1 - Math.sin(clickBounceProgress * Math.PI) * (0.08 * this.config.clickBounce),
@@ -1120,7 +1327,17 @@ export class PixiCursorOverlay {
const scaledH = h * getCursorStyleSizeMultiplier(this.config.style);
const swayRotation = this.updateCursorSway(px, py, timeMs, shouldFreezeCursorMotion);
- this.clickRingGraphics.clear();
+ drawClickEffectGraphics(
+ this.clickRingGraphics,
+ this.config.clickEffect,
+ px,
+ py,
+ scaledH,
+ clickProgress,
+ this.config.clickEffectScale,
+ this.config.clickEffectOpacity,
+ interactionType,
+ );
const spriteKey = (
cursorType in this.cursorSprites ? cursorType : "arrow"
@@ -1317,11 +1534,13 @@ export function drawCursorOnCanvas(
const px = viewport.x + smoothedState.x * viewport.width;
const py = viewport.y + smoothedState.y * viewport.height;
const h = config.dotRadius * getCursorViewportScale(viewport);
- const { cursorType, clickBounceProgress } = getCursorVisualState(
- samples,
- timeMs,
- config.clickBounceDuration,
- );
+ const { cursorType, interactionType, clickBounceProgress, clickProgress } =
+ getCursorVisualState(
+ samples,
+ timeMs,
+ config.clickBounceDuration,
+ config.clickEffectDurationMs,
+ );
const spriteKey = (
cursorType && loadedCursorAssets[cursorType] ? cursorType : "arrow"
) as CursorAssetKey;
@@ -1334,13 +1553,24 @@ export function drawCursorOnCanvas(
0.72,
1 - Math.sin(clickBounceProgress * Math.PI) * (0.08 * config.clickBounce),
);
+ const drawHeight = h * bounceScale * getCursorStyleSizeMultiplier(config.style);
+ drawClickEffectOnCanvas(
+ ctx,
+ config.clickEffect,
+ px,
+ py,
+ drawHeight,
+ clickProgress,
+ config.clickEffectScale,
+ config.clickEffectOpacity,
+ interactionType,
+ );
ctx.save();
if (config.style !== "figma") {
ctx.filter = CURSOR_SVG_DROP_SHADOW_FILTER;
}
- const drawHeight = h * bounceScale * getCursorStyleSizeMultiplier(config.style);
const drawWidth = drawHeight * asset.aspectRatio;
const hotspotX = asset.anchorX * drawWidth;
const hotspotY = asset.anchorY * drawHeight;
diff --git a/src/components/video-editor/videoPlayback/cursorViewport.ts b/src/components/video-editor/videoPlayback/cursorViewport.ts
index 96abfc07..8ed811c5 100644
--- a/src/components/video-editor/videoPlayback/cursorViewport.ts
+++ b/src/components/video-editor/videoPlayback/cursorViewport.ts
@@ -7,6 +7,8 @@ export interface CursorViewportRect {
y: number;
width: number;
height: number;
+ renderWidth?: number;
+ renderHeight?: number;
sourceCrop?: CropRegion;
}
diff --git a/src/i18n/locales/en/settings.json b/src/i18n/locales/en/settings.json
index b9a2d00a..97746633 100644
--- a/src/i18n/locales/en/settings.json
+++ b/src/i18n/locales/en/settings.json
@@ -97,6 +97,31 @@
"cursorSpringDamping": "Cursor Spring Damping",
"cursorSpringMass": "Cursor Spring Mass",
"off": "Off",
+ "cursorClickEffects": {
+ "title": "Click Effects",
+ "advanced": "Advanced",
+ "advancedShow": "Show advanced click effect controls",
+ "advancedHide": "Hide advanced click effect controls",
+ "size": "Effect Size",
+ "opacity": "Effect Opacity",
+ "duration": "Effect Duration",
+ "none": {
+ "label": "Off",
+ "description": "No click graphic. Only the cursor motion changes when you click."
+ },
+ "ripple": {
+ "label": "Ripple",
+ "description": "Expanding rings radiate from each click so taps read clearly in motion."
+ },
+ "spotlight": {
+ "label": "Spotlight",
+ "description": "A soft halo flashes around the pointer to emphasize the clicked area."
+ },
+ "burst": {
+ "label": "Burst",
+ "description": "A sharper radial burst adds more energy for demos and product walkthroughs."
+ }
+ },
"cursorMotionBlur": "Cursor Motion Blur",
"cursorClickBounce": "Cursor Click Bounce",
"cursorClickBounceDuration": "Bounce Speed",
diff --git a/src/lib/exporter/exportBitrate.test.ts b/src/lib/exporter/exportBitrate.test.ts
index 5b6c5f91..972e0156 100644
--- a/src/lib/exporter/exportBitrate.test.ts
+++ b/src/lib/exporter/exportBitrate.test.ts
@@ -15,6 +15,25 @@ describe("export bitrate policy", () => {
).toBe(27_000_000);
});
+ it("raises non-native export bitrate when fps increases", () => {
+ const bitrate30 = getMp4ExportBitrate({
+ width: 1920,
+ height: 1080,
+ frameRate: 30,
+ quality: "source",
+ encodingMode: "quality",
+ });
+ const bitrate60 = getMp4ExportBitrate({
+ width: 1920,
+ height: 1080,
+ frameRate: 60,
+ quality: "source",
+ encodingMode: "quality",
+ });
+
+ expect(bitrate60).toBeGreaterThan(bitrate30);
+ });
+
it("keeps modern native static-layout source exports high enough for screen text", () => {
expect(
getMp4ExportBitrate({
diff --git a/src/lib/exporter/exportBitrate.ts b/src/lib/exporter/exportBitrate.ts
index 7d3fa240..04c66c14 100644
--- a/src/lib/exporter/exportBitrate.ts
+++ b/src/lib/exporter/exportBitrate.ts
@@ -2,6 +2,7 @@ import type { ExportEncodingMode, ExportMp4FrameRate, ExportQuality } from "./ty
const MIN_MP4_BITRATE = 2_000_000;
const REFERENCE_PIXEL_RATE = 1920 * 1080 * 30;
+const REFERENCE_FRAME_RATE = 30;
export function getEncodingModeBitrateMultiplier(encodingMode: ExportEncodingMode): number {
switch (encodingMode) {
@@ -41,6 +42,10 @@ function getBaseMp4ExportBitrate(width: number, height: number, quality: ExportQ
return 30_000_000;
}
+function getFrameRateBitrateScale(frameRate: ExportMp4FrameRate): number {
+ return Math.sqrt(Math.max(frameRate, REFERENCE_FRAME_RATE) / REFERENCE_FRAME_RATE);
+}
+
function getModernNativeStaticLayoutBitrateCap(
width: number,
height: number,
@@ -87,7 +92,8 @@ export function getMp4ExportBitrate(options: {
}): number {
const requestedBitrate = Math.round(
getBaseMp4ExportBitrate(options.width, options.height, options.quality) *
- getEncodingModeBitrateMultiplier(options.encodingMode),
+ getEncodingModeBitrateMultiplier(options.encodingMode) *
+ getFrameRateBitrateScale(options.frameRate),
);
const nativeStaticLayoutBitrate =
options.useModernNativeStaticLayout && options.encodingMode !== "fast"