Expose setter for review timeline handlebar (#9978)

* expose setter for handlebar

* use as much resolution as possible
This commit is contained in:
Josh Hawkins
2024-02-22 08:16:37 -06:00
committed by GitHub
parent 746939ed4f
commit a5a1a54c55
3 changed files with 17 additions and 1 deletions

View File

@@ -12,6 +12,7 @@ interface DragHandlerProps {
isDragging: boolean;
setIsDragging: React.Dispatch<React.SetStateAction<boolean>>;
currentTimeRef: React.MutableRefObject<HTMLDivElement | null>;
setHandlebarTime?: React.Dispatch<React.SetStateAction<number>>;
}
// TODO: handle mobile touch events
@@ -27,6 +28,7 @@ function useDraggableHandler({
isDragging,
setIsDragging,
currentTimeRef,
setHandlebarTime,
}: DragHandlerProps) {
const handleMouseDown = useCallback(
(e: React.MouseEvent<HTMLDivElement>) => {
@@ -110,6 +112,9 @@ function useDraggableHandler({
});
}
});
if (setHandlebarTime) {
setHandlebarTime(timelineStart - segmentIndex * segmentDuration);
}
}
}
},