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:
Miguel Angel Simon Sierra
2026-07-28 16:44:42 +02:00
parent c691869e22
commit 69020699df
4 changed files with 178 additions and 1 deletions
@@ -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;
}