Create professional demos and 3D mockups in seconds, directly in your browser
fix: address camera review feedback
Efrain Chiri Ninaafb3f4095feb
diff --git a/app/[locale]/(editor)/editor/page.tsx b/app/[locale]/(editor)/editor/page.tsxindex 1c671a7..27ed912 100644--- a/app/[locale]/(editor)/editor/page.tsx+++ b/app/[locale]/(editor)/editor/page.tsx@@ -38,8 +38,10 @@ import { DEFAULT_MASK_CONFIG, PREVIEW_CONFIGS } from "@/types/photo.types";import { MOCKUPS } from "@/lib/mockup-data";import {createAutomaticMockupCameraTour,+ DEFAULT_MOCKUP_CAMERA_FOV,getAutomaticMockupCameraPreset,normalizeMockupCameraConfig,+ sampleMockupCameraKeyframes,} from "@/lib/viewer-controls3d";import type {MockupCameraKeyframe,@@ -426,12 +428,25 @@ export default function Editor() {}, [currentTime, mockupCameraKeyframes]);const handleSaveMockupCameraKeyframe = useCallback((time = currentTime) => {- upsertMockupCameraKeyframe({+ const sampledPose = sampleMockupCameraKeyframes(+ mockupCameraKeyframes,+ time,+ DEFAULT_MOCKUP_CAMERA_FOV[imagePhoneDevice],+ );+ upsertMockupCameraKeyframe(sampledPose ?? {camera: mockupCamera,rotationX: imagePhoneRotX,rotationY: imagePhoneRotY,}, time);- }, [upsertMockupCameraKeyframe, mockupCamera, imagePhoneRotX, imagePhoneRotY, currentTime]);+ }, [+ upsertMockupCameraKeyframe,+ mockupCameraKeyframes,+ imagePhoneDevice,+ mockupCamera,+ imagePhoneRotX,+ imagePhoneRotY,+ currentTime,+ ]);const handleApplyMockupCameraPreset = useCallback((preset: MockupCameraPreset) => {setMockupCamera(preset.camera);diff --git a/app/components/ui/editor/Mockup3dMenu.tsx b/app/components/ui/editor/Mockup3dMenu.tsxindex b35d48c..09cec62 100644--- a/app/components/ui/editor/Mockup3dMenu.tsx+++ b/app/components/ui/editor/Mockup3dMenu.tsx@@ -636,7 +636,7 @@ export function Mockup3dMenu({{mockupCameraKeyframes.length > 0 && (<span className="mr-auto font-mono text-[9px] text-muted-foreground" aria-label={`${t("cameraKeyframes")}: ${mockupCameraKeyframes.length}`}>{mockupCameraKeyframes.length} · {t("cameraKeyframes")}- {selectedCameraKeyframe && ` · ${currentTime.toFixed(1)}s`}+ {selectedCameraKeyframe && ` · ${selectedCameraKeyframe.time.toFixed(1)}s`}</span>)}{selectedCameraKeyframe && hasNextCameraKeyframe && (diff --git a/app/components/ui/editor/Timeline.tsx b/app/components/ui/editor/Timeline.tsxindex f602bb7..9776785 100644--- a/app/components/ui/editor/Timeline.tsx+++ b/app/components/ui/editor/Timeline.tsx@@ -1071,6 +1071,7 @@ export function Timeline({onClick={(event) => {if (!onAddMockupCameraKeyframeAtTime || contentWidth <= 0 || scaledDuration <= 0) return;if ((event.target as HTMLElement).closest("button")) return;+ event.stopPropagation();const bounds = event.currentTarget.getBoundingClientRect();const progress = Math.max(0, Math.min(1, (event.clientX - bounds.left) / contentWidth));onAddMockupCameraKeyframeAtTime(progress * scaledDuration);