From 7a7ae81d50fccf267ce4b870cae101fe92b20af8 Mon Sep 17 00:00:00 2001 From: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com> Date: Thu, 11 Apr 2024 08:29:34 -0500 Subject: [PATCH] always use full resolution time when dragging (#10939) --- web/src/components/timeline/ReviewTimeline.tsx | 1 + web/src/hooks/use-draggable-element.ts | 16 ++++++++-------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/web/src/components/timeline/ReviewTimeline.tsx b/web/src/components/timeline/ReviewTimeline.tsx index 2da91414d..e72fa34e0 100644 --- a/web/src/components/timeline/ReviewTimeline.tsx +++ b/web/src/components/timeline/ReviewTimeline.tsx @@ -107,6 +107,7 @@ export function ReviewTimeline({ showDraggableElement: showHandlebar, draggableElementTime: handlebarTime, setDraggableElementTime: setHandlebarTime, + alignSetTimeToSegment: true, initialScrollIntoViewOnly: onlyInitialHandlebarScroll, timelineDuration, timelineCollapsed: timelineCollapsed, diff --git a/web/src/hooks/use-draggable-element.ts b/web/src/hooks/use-draggable-element.ts index 4367907f6..75f733aeb 100644 --- a/web/src/hooks/use-draggable-element.ts +++ b/web/src/hooks/use-draggable-element.ts @@ -323,21 +323,21 @@ function useDraggableElement({ } } + const setTime = alignSetTimeToSegment + ? targetSegmentId + : targetSegmentId + segmentDuration * (offset / segmentHeight); + updateDraggableElementPosition( newElementPosition, - targetSegmentId, + setTime, false, false, ); if (setDraggableElementTime) { - if (alignSetTimeToSegment) { - setDraggableElementTime(targetSegmentId); - } else { - setDraggableElementTime( - targetSegmentId + segmentDuration * (offset / segmentHeight), - ); - } + setDraggableElementTime( + targetSegmentId + segmentDuration * (offset / segmentHeight), + ); } if (draggingAtTopEdge || draggingAtBottomEdge) {