Skip to main content

Module controller

Module controller 

Source

Structs§

ScrollController
Controls a [ScrollView] programmatically.

Constants§

COAST_STOP_THRESHOLD
Velocity magnitude (px/s) below which coasting is considered “stopped.” Raised from an earlier 0.5 — at 0.92 friction the tail from 0.5 down to truly zero motion is imperceptible but still real seconds of elapsed time; 15px/s is still much slower than any perceptible motion but cuts the long, invisible tail short. Combined with MAX_VELOCITY and a slightly higher friction (ScrollStyle::default_for_platform), brings total coast time for the full realistic velocity range down to ~0.35s-0.7s (confirmed by direct calculation), instead of 1.2s-1.9s+.
MAX_VELOCITY
Maximum tracked velocity (px/s), clamped in track_velocity/ set_velocity. Without a cap, a very fast flick produced a proportionally very long coast — found via real trackpad testing + direct calculation: at friction=0.92 even a modest 200px/s release took 1.2s to decay below the stop threshold, and higher speeds took longer still (1.9s+ at 6000px/s) — real touch/trackpad scroll views (iOS, Android) cap max fling velocity for exactly this reason, so a hard flick doesn’t feel unbounded/sluggish at the tail. 2500px/s is a fast, real flick speed, not an arbitrary round number — chosen so the slowest legitimate release still coasts, while capping how long the tail can run.
WHEEL_IDLE_GRACE
How long (real seconds) with no wheel event before a gesture is considered truly over and momentum/spring-back are allowed to run. Short enough that release still feels immediate, long enough to absorb normal gaps between OS-delivered wheel events during one continuous gesture.