diff options
| author | Maze Winther <mazewinther@gmail.com> | 2026-04-01 19:27:49 +0200 |
|---|---|---|
| committer | Maze Winther <mazewinther@gmail.com> | 2026-04-01 19:27:49 +0200 |
| commit | bd9ec023eefc4b5d26fa8b66c4338e97104f0f96 (patch) | |
| tree | 08350eaa107b27f026eebdb65df54b1ca25521fd /apps/web/src/hooks/timeline/use-timeline-playhead.ts | |
| parent | f4b9f40ab1ba1cedf208bba708f4331d36bb30cc (diff) | |
| download | opencut-bd9ec023eefc4b5d26fa8b66c4338e97104f0f96.tar.gz | |
refactor: split constants by domain and isolate timeline panel from core
Diffstat (limited to 'apps/web/src/hooks/timeline/use-timeline-playhead.ts')
| -rw-r--r-- | apps/web/src/hooks/timeline/use-timeline-playhead.ts | 10 |
1 files changed, 5 insertions, 5 deletions
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; |
