diff options
| author | Maze Winther <mazewinther@gmail.com> | 2026-03-25 16:47:22 +0100 |
|---|---|---|
| committer | Maze Winther <mazewinther@gmail.com> | 2026-03-29 15:48:22 +0200 |
| commit | 8db3bead13441a5882d8689dfc6a9f09c82375d9 (patch) | |
| tree | e9d0cafa93904ffcbec3188c37961bcc16c6422d /apps/web/src/hooks/timeline/use-snap-indicator-position.ts | |
| parent | 39ea298a9ccba3104c549c0ca079c231981811f5 (diff) | |
| download | opencut-8db3bead13441a5882d8689dfc6a9f09c82375d9.tar.gz | |
feat: masks, properties refactor, shaders, storage migrations, and more
Diffstat (limited to 'apps/web/src/hooks/timeline/use-snap-indicator-position.ts')
| -rw-r--r-- | apps/web/src/hooks/timeline/use-snap-indicator-position.ts | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/apps/web/src/hooks/timeline/use-snap-indicator-position.ts b/apps/web/src/hooks/timeline/use-snap-indicator-position.ts index f3e63894..1a8f3c5d 100644 --- a/apps/web/src/hooks/timeline/use-snap-indicator-position.ts +++ b/apps/web/src/hooks/timeline/use-snap-indicator-position.ts @@ -1,13 +1,10 @@ import { useEffect, useState } from "react"; import { timelineTimeToSnappedPixels } from "@/lib/timeline"; -import type { TimelineTrack } from "@/types/timeline"; - +import { TRACK_LABELS_WIDTH_PX } from "@/constants/timeline-constants"; interface UseSnapIndicatorPositionParams { snapPoint: { time: number } | null; zoomLevel: number; - tracks: TimelineTrack[]; timelineRef: React.RefObject<HTMLDivElement | null>; - trackLabelsRef?: React.RefObject<HTMLDivElement | null>; tracksScrollRef: React.RefObject<HTMLDivElement | null>; } @@ -20,9 +17,7 @@ interface SnapIndicatorPosition { export function useSnapIndicatorPosition({ snapPoint, zoomLevel, - tracks, timelineRef, - trackLabelsRef, tracksScrollRef, }: UseSnapIndicatorPositionParams): SnapIndicatorPosition { const [scrollLeft, setScrollLeft] = useState(0); @@ -45,16 +40,11 @@ export function useSnapIndicatorPosition({ const timelineContainerHeight = timelineRef.current?.offsetHeight || 400; const totalHeight = timelineContainerHeight - 8; // 8px padding from edges - const trackLabelsWidth = - tracks.length > 0 && trackLabelsRef?.current - ? trackLabelsRef.current.offsetWidth - : 0; - const timelinePosition = timelineTimeToSnappedPixels({ time: snapPoint?.time ?? 0, zoomLevel, }); - const leftPosition = trackLabelsWidth + timelinePosition - scrollLeft; + const leftPosition = TRACK_LABELS_WIDTH_PX + timelinePosition - scrollLeft; return { leftPosition, |
