From 53d6d0e1afe05b678cf97bbb277be8af335a8a97 Mon Sep 17 00:00:00 2001 From: Maze Winther Date: Wed, 9 Jul 2025 22:07:25 +0200 Subject: [PATCH] fix: zoom on entire timeline --- apps/web/src/components/editor/timeline.tsx | 22 +++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/apps/web/src/components/editor/timeline.tsx b/apps/web/src/components/editor/timeline.tsx index 7703f1e..3c8315d 100644 --- a/apps/web/src/components/editor/timeline.tsx +++ b/apps/web/src/components/editor/timeline.tsx @@ -90,6 +90,7 @@ export function Timeline() { const [progress, setProgress] = useState(0); const dragCounterRef = useRef(0); const timelineRef = useRef(null); + const rulerRef = useRef(null); const [isInTimeline, setIsInTimeline] = useState(false); // Timeline zoom functionality @@ -471,9 +472,9 @@ export function Timeline() { const handleScrub = useCallback( (e: MouseEvent | React.MouseEvent) => { - const timeline = timelineRef.current; - if (!timeline) return; - const rect = timeline.getBoundingClientRect(); + const ruler = rulerRef.current; + if (!ruler) return; + const rect = ruler.getBoundingClientRect(); const x = e.clientX - rect.left; const time = Math.max(0, Math.min(duration, x / (50 * zoomLevel))); setScrubTime(time); @@ -729,7 +730,6 @@ export function Timeline() { {...dragProps} onMouseEnter={() => setIsInTimeline(true)} onMouseLeave={() => setIsInTimeline(false)} - onWheel={handleWheel} > {/* Toolbar */}
@@ -886,7 +886,7 @@ export function Timeline() {
{/* Timeline Container */} -
+
{/* Timeline Header with Ruler */}
{/* Track Labels Header */} @@ -897,10 +897,13 @@ export function Timeline() {
{/* Timeline Ruler */} -
+
+