diff --git a/apps/web/src/components/editor/timeline.tsx b/apps/web/src/components/editor/timeline.tsx index 46aaf13..2d60102 100644 --- a/apps/web/src/components/editor/timeline.tsx +++ b/apps/web/src/components/editor/timeline.tsx @@ -611,7 +611,7 @@ export function Timeline() { rulerViewport.removeEventListener('scroll', handleRulerScroll); tracksViewport.removeEventListener('scroll', handleTracksScroll); }; - }, [duration, zoomLevel]); + }, []); // --- Playhead auto-scroll effect --- useEffect(() => { @@ -622,21 +622,17 @@ export function Timeline() { const viewportWidth = rulerViewport.clientWidth; const scrollMin = 0; const scrollMax = rulerViewport.scrollWidth - viewportWidth; - // Center the playhead if it's not visible (60px buffer) + // Center the playhead if it's not visible (100px buffer) const desiredScroll = Math.max( scrollMin, Math.min(scrollMax, playheadPx - viewportWidth / 2) ); if ( - playheadPx < rulerViewport.scrollLeft + 60 || - playheadPx > rulerViewport.scrollLeft + viewportWidth - 60 + playheadPx < rulerViewport.scrollLeft + 100 || + playheadPx > rulerViewport.scrollLeft + viewportWidth - 100 ) { rulerViewport.scrollLeft = tracksViewport.scrollLeft = desiredScroll; } - // Keep both scrolls in sync - if (rulerViewport.scrollLeft !== tracksViewport.scrollLeft) { - rulerViewport.scrollLeft = tracksViewport.scrollLeft = Math.max(rulerViewport.scrollLeft, tracksViewport.scrollLeft); - } }, [playheadPosition, duration, zoomLevel]); return (