pub struct EdgeStretch { /* private fields */ }Expand description
Android 12/13 EdgeEffect (TYPE_STRETCH) overscroll spring state machine.
Positive distance = pulling away from the start edge (top / left);
negative distance = pulling away from the end edge (bottom / right).
Implementations§
Source§impl EdgeStretch
impl EdgeStretch
Sourcepub fn pull(&mut self, delta_dp: f32, extent_dp: f32) -> f32
pub fn pull(&mut self, delta_dp: f32, extent_dp: f32) -> f32
Pull the edge effect by delta_dp (+ = start edge pull, - = end edge pull).
Returns the portion of delta_dp consumed by stretching or un-stretching.
Sourcepub fn release(&mut self)
pub fn release(&mut self)
Release an active stretch pull so the AOSP damped spring recoils smoothly to 0.
Sourcepub fn absorb(&mut self, impact_vel_dp_s: f32, extent_dp: f32)
pub fn absorb(&mut self, impact_vel_dp_s: f32, extent_dp: f32)
Absorb fling impact velocity (impact_vel_dp_s: + = top/start edge hit, - = bottom/end edge hit).
Sourcepub fn step(&mut self, dt: f32, extent_dp: f32, reduced: bool) -> bool
pub fn step(&mut self, dt: f32, extent_dp: f32, reduced: bool) -> bool
Advance the AOSP damped harmonic oscillator by dt seconds. Returns true while active.
Sourcepub fn scale_and_sign(&self) -> (f32, f32)
pub fn scale_and_sign(&self) -> (f32, f32)
Returns (scale_factor, edge_sign) where scale_factor >= 1.0 and
edge_sign is +1.0 (start/top edge), -1.0 (end/bottom edge), or 0.0 (idle).