Repository navigation
mobile: smooth-coast - #852
Conversation
Fling.step integrated the decaying speed with an Euler step (speed times the frame gap, then decay), so the same flick travelled differently on uneven frame times. It now applies the exact integral over the frame. Agent-Team: linux Worker: claude Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
PM note: how this PR will be handledWhat it is for: mobile: smooth-coast Rules that apply: none special. Things to watch (checked by rule):
What happens next:
A living status comment below is kept current. Nothing here is a merge decision. |
Where this PR standsStage: Done: approved What the PM needs before approving (ticks as it is met; the full CI runs only at the end, after the reviews are clean):
Reviews at the current commit (
Updated 2026-10-26 13:28 UTC by the PM. This comment is edited in place. |
Part of fizzyedit/work#362
Goal
Smoother touch coast on mobile (work#362): the content should be at the same place at the same timestamp however the browser cuts the frames.
What changed and why
Fling.stepmoved byvel * dtand then decayedvel, an Euler step: the distance covered depended on how the clock was cut into frames (about 3% off at 33 ms steps, and different for uneven gaps). It now moves by the exact integralvel * (1 - e^(-k dt)) / k, so position isp0 + v/k * (1 - e^(-k (t - t0)))at each frame's own timestamp. Decay, windowed release speed and thresholds are unchanged.CanvasWidget's pan fling sharesFling.stepand gets the same fix.How it was verified
New test
the coast is a function of time, not of how the frames cut it(ScrollArea.zig): the same flick coasted with steady 33 ms frames and with frames alternating 8 and 25 ms, compared at equal timestamps. Fails before (steady vs jittery differ by 0.16 pt at step 1 growing to 1.56 pt at step 14 of 15; e.g. 136.69 vs 135.13), passes after (identical to 0.01 pt: 19.31 / 31.28 / ... / 132.39). Total travel over 0.5 s: 136.7 before, 132.4 after (the true curve; the old Euler step overshot it). The test reads the viewport after the area'sdeinit(it read it a frame early). Gates: check-fmt, build, test, test-integration, check-web, test-sdk-version, lint, check-tests-reached all pass. Not seen on a phone.Not done / follow-ups
Causes (2) device-pixel snapping, (3) a refresh per display frame and (4) heavy frames were not measured: this PR fixes only the time-integration cause (1); the code requests a refresh each coasting frame already. If foxnne still sees hitching on the main web build, profile
core.profileframes and the snapping next.Changes (2 files, +33/-4)
Gates: 6 of 6 passed
scripts/check-fmt.sh(exit 0)scripts/zb build --summary all(exit 0)scripts/zb build test --summary all(exit 0)scripts/zb build test-integration --summary all(exit 0)scripts/zb build check-web --summary all(exit 0)scripts/zb build test-sdk-version --summary all(exit 0)