Skip to main content

drift_velocity

Function drift_velocity 

Source
pub fn drift_velocity(pointer: Pixels, start: Pixels, end: Pixels) -> f32
Expand description

How far a pane should travel in a second, for a pointer at pointer between edges start and end.

Signed the way gpui’s offset is: positive travels back toward the start, because the offset goes negative as a pane scrolls on. Zero everywhere but within DRIFT_EDGE of an edge, where it ramps with proximity — easing toward the edge eases the scroll — and holds at full speed once the pointer is past it, so a card carried off the side of a board keeps it coming instead of stopping dead at the boundary.

The ramp is capped at half the pane, so one narrower than two edges has a still middle rather than a midpoint where the direction flips at half speed.