mirror of
https://github.com/blakeblackshear/frigate.git
synced 2024-11-21 19:07:46 +01:00
Fix resolution of timeline dragging (#10219)
This commit is contained in:
parent
a515697e08
commit
1441a83151
@ -68,7 +68,11 @@ function useDraggableHandler({
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const updateHandlebarPosition = useCallback(
|
const updateHandlebarPosition = useCallback(
|
||||||
(newHandlePosition: number, segmentStartTime: number) => {
|
(
|
||||||
|
newHandlePosition: number,
|
||||||
|
segmentStartTime: number,
|
||||||
|
updateHandle: boolean,
|
||||||
|
) => {
|
||||||
const thumb = scrollTimeRef.current;
|
const thumb = scrollTimeRef.current;
|
||||||
if (thumb) {
|
if (thumb) {
|
||||||
requestAnimationFrame(() => {
|
requestAnimationFrame(() => {
|
||||||
@ -87,7 +91,8 @@ function useDraggableHandler({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (setHandlebarTime) {
|
|
||||||
|
if (setHandlebarTime && updateHandle) {
|
||||||
setHandlebarTime(segmentStartTime);
|
setHandlebarTime(segmentStartTime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -146,7 +151,15 @@ function useDraggableHandler({
|
|||||||
updateHandlebarPosition(
|
updateHandlebarPosition(
|
||||||
newHandlePosition - segmentHeight,
|
newHandlePosition - segmentHeight,
|
||||||
segmentStartTime,
|
segmentStartTime,
|
||||||
|
false,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (setHandlebarTime) {
|
||||||
|
setHandlebarTime(
|
||||||
|
timelineStart -
|
||||||
|
(newHandlePosition / segmentHeight) * segmentDuration,
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// we know that these deps are correct
|
// we know that these deps are correct
|
||||||
@ -185,7 +198,11 @@ function useDraggableHandler({
|
|||||||
parentScrollTop -
|
parentScrollTop -
|
||||||
scrolled;
|
scrolled;
|
||||||
|
|
||||||
updateHandlebarPosition(newHandlePosition - segmentHeight, handlebarTime);
|
updateHandlebarPosition(
|
||||||
|
newHandlePosition - segmentHeight,
|
||||||
|
handlebarTime,
|
||||||
|
true,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
// we know that these deps are correct
|
// we know that these deps are correct
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
Loading…
Reference in New Issue
Block a user