Struct RubberBand
pub struct RubberBand { /* private fields */ }Expand description
The give of a scroll view past its ends, per axis: negative before the start, positive past the end, in logical pixels.
Implementations§
§impl RubberBand
impl RubberBand
pub const SPEC: MotionSpec
pub const SPEC: MotionSpec
The spring back: fast; reduced motion has no give to spring from,
and nothing a shortcut does stretches it.
pub fn new() -> RubberBand
pub fn pull(
&mut self,
excess: Vec2,
viewport: Vec2,
motion: EffectiveMotion,
now: Instant,
)
pub fn pull( &mut self, excess: Vec2, viewport: Vec2, motion: EffectiveMotion, now: Instant, )
The hand asked the content excess past its ends this input (what
the content could not take, per axis; zero where it took it all), in
a view viewport large: the give follows through the band. A give
springing back is caught where it is drawn.
pub fn take_in(
&mut self,
delta: Vec2,
viewport: Vec2,
motion: EffectiveMotion,
now: Instant,
) -> Vec2
pub fn take_in( &mut self, delta: Vec2, viewport: Vec2, motion: EffectiveMotion, now: Instant, ) -> Vec2
The hand moved the content by delta while it may hold a give: the
part of it that goes back toward the ends takes the give in first,
through the band. Returns what is left to move the content by.
pub fn release(
&mut self,
velocity: Vec2,
viewport: Vec2,
motion: EffectiveMotion,
now: Instant,
)
pub fn release( &mut self, velocity: Vec2, viewport: Vec2, motion: EffectiveMotion, now: Instant, )
The hand let go moving the content at velocity (logical pixels per
second): the give springs back to the ends, starting at the speed the
band gave it there.
pub fn stop(&mut self)
pub fn stop(&mut self)
No give, at once.
pub fn give(&self, now: Instant, device_scale: f64) -> Vec2
pub fn give(&self, now: Instant, device_scale: f64) -> Vec2
The give drawn at now, in whole device pixels of device_scale
per logical pixel, so a host that copies what a scroll keeps copies
it.
pub fn needs_frame(&self, now: Instant, device_scale: f64) -> bool
pub fn needs_frame(&self, now: Instant, device_scale: f64) -> bool
Whether the content wants a frame for its give: it springs back, or was last drawn with another give than it has now.
pub fn is_stretched(&self, now: Instant) -> bool
pub fn is_stretched(&self, now: Instant) -> bool
Whether the content stands past an end, held or springing back.
pub fn settles_at(&self) -> Option<Instant>
pub fn settles_at(&self) -> Option<Instant>
When the spring back arrives; None at rest.
Trait Implementations§
§impl Clone for RubberBand
impl Clone for RubberBand
§fn clone(&self) -> RubberBand
fn clone(&self) -> RubberBand
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for RubberBand
impl Debug for RubberBand
§impl Default for RubberBand
impl Default for RubberBand
§fn default() -> RubberBand
fn default() -> RubberBand
Auto Trait Implementations§
impl !Freeze for RubberBand
impl !RefUnwindSafe for RubberBand
impl Send for RubberBand
impl !Sync for RubberBand
impl Unpin for RubberBand
impl UnsafeUnpin for RubberBand
impl UnwindSafe for RubberBand
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more