pub struct BouncingScrollSimulation {
pub leading_extent: f64,
pub trailing_extent: f64,
pub spring: SpringDescription,
pub tolerance: Tolerance,
/* private fields */
}Expand description
An implementation of scroll physics that matches iOS.
See also:
ClampingScrollSimulation, which implements Android scroll physics.
Fields§
§leading_extent: f64When x falls below this value the simulation switches from an
internal friction model to a spring model which causes
x to “spring” back to leading_extent.
trailing_extent: f64When x exceeds this value the simulation switches from an
internal friction model to a spring model which causes
x to “spring” back to trailing_extent.
spring: SpringDescriptionThe spring used to return x to either
leading_extent or
trailing_extent.
tolerance: ToleranceHow close to the actual end of the simulation a value at a particular
time must be before is_done considers the
simulation to be “done”.
Implementations§
Source§impl BouncingScrollSimulation
impl BouncingScrollSimulation
Sourcepub const MAX_SPRING_TRANSFER_VELOCITY: f64 = 5000.0
pub const MAX_SPRING_TRANSFER_VELOCITY: f64 = 5000.0
The maximum velocity that can be transferred from the inertia of a ballistic scroll into overscroll.
Sourcepub fn new(
position: f64,
velocity: f64,
leading_extent: f64,
trailing_extent: f64,
spring: SpringDescription,
) -> BouncingScrollSimulation
pub fn new( position: f64, velocity: f64, leading_extent: f64, trailing_extent: f64, spring: SpringDescription, ) -> BouncingScrollSimulation
Creates a simulation group for scrolling on iOS, with the given parameters.
The position and velocity arguments must use the same units as will be
expected from the x and dx methods
respectively (typically logical pixels and logical pixels per second
respectively).
The leading and trailing extents must use the unit of length, the same
unit as used for the position argument and as expected from the
x method (typically logical pixels).
The units used with the provided SpringDescription must similarly be
consistent with the other arguments.
Sourcepub fn with_options(
position: f64,
velocity: f64,
leading_extent: f64,
trailing_extent: f64,
spring: SpringDescription,
constant_deceleration: f64,
tolerance: Tolerance,
) -> BouncingScrollSimulation
pub fn with_options( position: f64, velocity: f64, leading_extent: f64, trailing_extent: f64, spring: SpringDescription, constant_deceleration: f64, tolerance: Tolerance, ) -> BouncingScrollSimulation
Dart’s constantDeceleration / tolerance named arguments.
Trait Implementations§
Source§impl Debug for BouncingScrollSimulation
impl Debug for BouncingScrollSimulation
Source§impl Simulation for BouncingScrollSimulation
impl Simulation for BouncingScrollSimulation
Source§fn set_tolerance(&mut self, tolerance: Tolerance)
fn set_tolerance(&mut self, tolerance: Tolerance)
Dart’s _simulation assigns this simulation’s tolerance to whichever inner
simulation it hands back, on every query; the inner simulations are built with it
and it is pushed down here instead, which no caller can tell apart.