From bd9ec023eefc4b5d26fa8b66c4338e97104f0f96 Mon Sep 17 00:00:00 2001 From: Maze Winther Date: Wed, 1 Apr 2026 19:27:49 +0200 Subject: refactor: split constants by domain and isolate timeline panel from core --- apps/web/src/hooks/timeline/use-timeline-playhead.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'apps/web/src/hooks/timeline/use-timeline-playhead.ts') diff --git a/apps/web/src/hooks/timeline/use-timeline-playhead.ts b/apps/web/src/hooks/timeline/use-timeline-playhead.ts index d4cfcc06..fce84135 100644 --- a/apps/web/src/hooks/timeline/use-timeline-playhead.ts +++ b/apps/web/src/hooks/timeline/use-timeline-playhead.ts @@ -8,7 +8,7 @@ import { getCenteredLineLeft, timelineTimeToSnappedPixels, } from "@/lib/timeline"; -import { TIMELINE_CONSTANTS } from "@/constants/timeline-constants"; +import { BASE_TIMELINE_PIXELS_PER_SECOND } from "@/lib/timeline/scale"; interface UseTimelinePlayheadProps { zoomLevel: number; @@ -67,7 +67,7 @@ export function useTimelinePlayhead({ const relativeMouseX = event.clientX - rulerRect.left; const timelineContentWidth = - duration * TIMELINE_CONSTANTS.PIXELS_PER_SECOND * zoomLevel; + duration * BASE_TIMELINE_PIXELS_PER_SECOND * zoomLevel; const clampedMouseX = Math.max( 0, @@ -78,7 +78,7 @@ export function useTimelinePlayhead({ 0, Math.min( duration, - clampedMouseX / (TIMELINE_CONSTANTS.PIXELS_PER_SECOND * zoomLevel), + clampedMouseX / (BASE_TIMELINE_PIXELS_PER_SECOND * zoomLevel), ), ); @@ -161,7 +161,7 @@ export function useTimelinePlayhead({ getMouseClientX: () => lastMouseXRef.current, rulerScrollRef, tracksScrollRef, - contentWidth: duration * TIMELINE_CONSTANTS.PIXELS_PER_SECOND * zoomLevel, + contentWidth: duration * BASE_TIMELINE_PIXELS_PER_SECOND * zoomLevel, }); useEffect(() => { @@ -248,7 +248,7 @@ export function useTimelinePlayhead({ if (!rulerViewport || !tracksViewport) return; const playheadPixels = - time * TIMELINE_CONSTANTS.PIXELS_PER_SECOND * zoomLevelRef.current; + time * BASE_TIMELINE_PIXELS_PER_SECOND * zoomLevelRef.current; const viewportWidth = rulerViewport.clientWidth; const scrollMinimum = 0; const scrollMaximum = rulerViewport.scrollWidth - viewportWidth; -- cgit v1.3.1