diff --git a/src/components/video-editor/SettingsPanel.tsx b/src/components/video-editor/SettingsPanel.tsx index bec50c2..bc7ebb0 100644 --- a/src/components/video-editor/SettingsPanel.tsx +++ b/src/components/video-editor/SettingsPanel.tsx @@ -52,6 +52,7 @@ import type { PlaybackSpeed, WebcamLayoutPreset, ZoomDepth, + ZoomFocusMode, } from "./types"; import { SPEED_OPTIONS } from "./types"; @@ -92,8 +93,8 @@ interface SettingsPanelProps { onWallpaperChange: (path: string) => void; selectedZoomDepth?: ZoomDepth | null; onZoomDepthChange?: (depth: ZoomDepth) => void; - selectedZoomFocusMode?: import("./types").ZoomFocusMode | null; - onZoomFocusModeChange?: (mode: import("./types").ZoomFocusMode) => void; + selectedZoomFocusMode?: ZoomFocusMode | null; + onZoomFocusModeChange?: (mode: ZoomFocusMode) => void; hasCursorTelemetry?: boolean; selectedZoomId?: string | null; onZoomDelete?: (id: string) => void; diff --git a/src/components/video-editor/videoPlayback/zoomRegionUtils.ts b/src/components/video-editor/videoPlayback/zoomRegionUtils.ts index 3f8a132..8543907 100644 --- a/src/components/video-editor/videoPlayback/zoomRegionUtils.ts +++ b/src/components/video-editor/videoPlayback/zoomRegionUtils.ts @@ -199,8 +199,21 @@ function getConnectedRegionTransition( const currentScale = ZOOM_DEPTH_SCALES[currentRegion.depth]; const nextScale = ZOOM_DEPTH_SCALES[nextRegion.depth]; const transitionScale = lerp(currentScale, nextScale, transitionProgress); - const currentFocus = getResolvedFocus(currentRegion, currentScale, timeMs, cursorTelemetry); - const nextFocus = getResolvedFocus(nextRegion, nextScale, timeMs, cursorTelemetry); + // Both regions share the same timeMs, so interpolate cursor once and reuse. + const sharedCursorFocus = + cursorTelemetry && cursorTelemetry.length > 0 + ? interpolateCursorAt(cursorTelemetry, timeMs) + : null; + const currentFocus = clampFocusToScale( + currentRegion.focusMode === "auto" && sharedCursorFocus + ? sharedCursorFocus + : currentRegion.focus, + currentScale, + ); + const nextFocus = clampFocusToScale( + nextRegion.focusMode === "auto" && sharedCursorFocus ? sharedCursorFocus : nextRegion.focus, + nextScale, + ); const transitionFocus = getLinearFocus(currentFocus, nextFocus, transitionProgress); return {