forked from Github/frigate
Summary timeline (#10569)
* implement summary timeline * implement summary timeline * merge dev * conditionally attach listeners only when dragging * set up listeners with a ref
This commit is contained in:
@@ -40,7 +40,8 @@ function useDraggableElement({
|
||||
}: DraggableElementProps) {
|
||||
const [clientYPosition, setClientYPosition] = useState<number | null>(null);
|
||||
const [initialClickAdjustment, setInitialClickAdjustment] = useState(0);
|
||||
const { alignStartDateToTimeline } = useTimelineUtils(segmentDuration);
|
||||
const { alignStartDateToTimeline, getCumulativeScrollTop } =
|
||||
useTimelineUtils(segmentDuration);
|
||||
|
||||
const draggingAtTopEdge = useMemo(() => {
|
||||
if (clientYPosition && timelineRef.current) {
|
||||
@@ -125,15 +126,6 @@ function useDraggableElement({
|
||||
[isDragging, setIsDragging],
|
||||
);
|
||||
|
||||
const getCumulativeScrollTop = useCallback((element: HTMLElement | null) => {
|
||||
let scrollTop = 0;
|
||||
while (element) {
|
||||
scrollTop += element.scrollTop;
|
||||
element = element.parentElement;
|
||||
}
|
||||
return scrollTop;
|
||||
}, []);
|
||||
|
||||
const timestampToPixels = useCallback(
|
||||
(time: number) => {
|
||||
const { scrollHeight: timelineHeight } =
|
||||
|
||||
Reference in New Issue
Block a user