Skip to content

Create professional demos and 3D mockups in seconds, directly in your browser

fix: clamp camera keyframes to valid timeline

Efrain Chiri Nina602c6bdf9586
diff --git a/app/components/ui/editor/Timeline.tsx b/app/components/ui/editor/Timeline.tsx
index 9776785..f5a91c0 100644
--- a/app/components/ui/editor/Timeline.tsx
+++ b/app/components/ui/editor/Timeline.tsx
@@ -1074,7 +1074,10 @@ export function Timeline({
event.stopPropagation();
const bounds = event.currentTarget.getBoundingClientRect();
const progress = Math.max(0, Math.min(1, (event.clientX - bounds.left) / contentWidth));
- onAddMockupCameraKeyframeAtTime(progress * scaledDuration);
+ const rawTime = progress * scaledDuration;
+ const boundedTime = Math.max(0, Math.min(validDuration, rawTime));
+ const clampedTime = Math.max(trimRange.start, Math.min(trimRange.end, boundedTime));
+ onAddMockupCameraKeyframeAtTime(clampedTime);
}}
>
<div className="pointer-events-none absolute inset-x-0 top-1/2 h-px bg-primary/15" aria-hidden="true" />