always use full resolution time when dragging (#10939)

This commit is contained in:
Josh Hawkins 2024-04-11 08:29:34 -05:00 committed by GitHub
parent fb6f415b27
commit 7a7ae81d50
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 8 deletions

View File

@ -107,6 +107,7 @@ export function ReviewTimeline({
showDraggableElement: showHandlebar, showDraggableElement: showHandlebar,
draggableElementTime: handlebarTime, draggableElementTime: handlebarTime,
setDraggableElementTime: setHandlebarTime, setDraggableElementTime: setHandlebarTime,
alignSetTimeToSegment: true,
initialScrollIntoViewOnly: onlyInitialHandlebarScroll, initialScrollIntoViewOnly: onlyInitialHandlebarScroll,
timelineDuration, timelineDuration,
timelineCollapsed: timelineCollapsed, timelineCollapsed: timelineCollapsed,

View File

@ -323,22 +323,22 @@ function useDraggableElement({
} }
} }
const setTime = alignSetTimeToSegment
? targetSegmentId
: targetSegmentId + segmentDuration * (offset / segmentHeight);
updateDraggableElementPosition( updateDraggableElementPosition(
newElementPosition, newElementPosition,
targetSegmentId, setTime,
false, false,
false, false,
); );
if (setDraggableElementTime) { if (setDraggableElementTime) {
if (alignSetTimeToSegment) {
setDraggableElementTime(targetSegmentId);
} else {
setDraggableElementTime( setDraggableElementTime(
targetSegmentId + segmentDuration * (offset / segmentHeight), targetSegmentId + segmentDuration * (offset / segmentHeight),
); );
} }
}
if (draggingAtTopEdge || draggingAtBottomEdge) { if (draggingAtTopEdge || draggingAtBottomEdge) {
animationFrameId = requestAnimationFrame(handleScroll); animationFrameId = requestAnimationFrame(handleScroll);