Skip to main content

Module scrollbar_repeat

Module scrollbar_repeat 

Source
Expand description

Track-press auto-repeat for scrollbars.

Compose parity (TrackPressScroller in compose/foundation/.../Scrollbar.skiko.kt): pressing the scrollbar track outside the thumb pages once immediately, then keeps paging toward the held point after a 300ms delay, every 100ms, until release.

The repeat itself cannot live in the scrollbar hit closures: those run on input dispatch, but repeats must fire on time even when the pointer sits still and no input arrives. So the track-press closure registers a page callback here, and the app runtime polls it once per tick next to poll_long_press, with the next fire time feeding next_wakeup_deadline so a sleeping host still wakes up to page.

Functionsยง

begin_track_repeat
Start (or restart) paging for pointer. The caller pages once immediately; the first repeat fires [FIRST_DELAY_MS] later.
cancel_all_track_repeats
Stop every repeat. Used on global pointer cancel, where per-pointer bookkeeping may already be gone.
cancel_track_repeat
Stop paging for pointer. No-op when another pointer holds the repeat.
cancel_track_repeat_for_touch
Convenience for runtime press/release/cancel paths.
key_for_touch
Same key from the runtime side, which addresses pointers by touch id.
pointer_key
Stable key for the pointer behind an event. Touch fingers keep their id so two fingers can hold two tracks; mouse and pen collapse to one key.
poll_track_repeat
Fire due repeats. Call once per tick next to the other gesture polls. Returns true when a page ran (and a frame was requested).
track_repeat_deadline
Next repeat fire time, for the host wakeup deadline.