mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-11 23:00:03 +00:00
fix(studio): seek ruler clicks to the pressed position and round retime percentages
A ruler press with no pointer movement settled the playhead at t=0 instead of the clicked time. handlePointerUp replays pendingClientXRef, which only the pointermove path wrote, so a plain click fell back to the ref's initial 0 and overwrote the correct pointerdown seek. Seed the ref on pointerdown. The keyframe retime move branch also returned the raw quotient while the resize branch rounded to 3dp, so values like 74.81203007518799% landed in the user's source and churned the diff on every drag. Round at the point of computation so the no-op test and the written value agree.
This commit is contained in:
@@ -268,6 +268,11 @@ export function useTimelineRangeSelection({
|
||||
if (!point || !scrollRect || isTimelineRulerPress(e.clientY, scrollRect.top)) {
|
||||
isDragging.current = true;
|
||||
setIsScrubbing(true);
|
||||
// Seed the pending coordinate so a press with no pointermove still
|
||||
// replays THIS x on pointerup. `updateScrubDrag` is the only other
|
||||
// writer, so without this a plain click settles on the ref's initial
|
||||
// 0 and clamps the playhead back to t=0.
|
||||
pendingClientXRef.current = e.clientX;
|
||||
seekFromX(e.clientX);
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user