Struct ScrollTo
pub struct ScrollTo { /* private fields */ }Expand description
A scroll view’s motion toward what it was asked to show.
Implementations§
§impl ScrollTo
impl ScrollTo
pub const SPEC: MotionSpec
pub const SPEC: MotionSpec
The glide: fast both ways; a key’s jump still glides (spatial
context, fast at most); reduced motion lands.
pub const FADE: MotionSpec
pub const FADE: MotionSpec
The fade-in after a long jump: fast, also under reduced motion and
for a key’s jump.
pub const GLIDE_VIEWPORTS: f64 = 3.0
pub const GLIDE_VIEWPORTS: f64 = 3.0
The longest jump, in viewports along either axis, that glides; a longer one fades in at the target.
pub fn new() -> ScrollTo
pub fn go(
&mut self,
drawn: Vec2,
target: Vec2,
viewport: Vec2,
motion: EffectiveMotion,
now: Instant,
) -> ScrollJump
pub fn go( &mut self, drawn: Vec2, target: Vec2, viewport: Vec2, motion: EffectiveMotion, now: Instant, ) -> ScrollJump
Move the content from drawn, the offset it is drawn at now, to
target, in a view viewport large. The input the person just
made decides how (super::recent_input): a click, a finger or a key
glides a short jump and fades in a long one; with no recent input (a
sync, a restored view, a script) or for an agent’s action, it lands.
A jump while gliding retargets from where the content is drawn and
how fast it moves there.
pub fn go_from(
&mut self,
drawn: Vec2,
target: Vec2,
viewport: Vec2,
motion: EffectiveMotion,
source: MotionSource,
now: Instant,
) -> ScrollJump
pub fn go_from( &mut self, drawn: Vec2, target: Vec2, viewport: Vec2, motion: EffectiveMotion, source: MotionSource, now: Instant, ) -> ScrollJump
Self::go for a jump source caused.
pub fn settle(
&mut self,
drawn: Vec2,
target: Vec2,
velocity: Vec2,
motion: EffectiveMotion,
source: MotionSource,
now: Instant,
) -> ScrollJump
pub fn settle( &mut self, drawn: Vec2, target: Vec2, velocity: Vec2, motion: EffectiveMotion, source: MotionSource, now: Instant, ) -> ScrollJump
Settle on target, the way a scroll view whose content offers
detents comes to rest on one (super::Snap): a gesture’s release
hands its velocity to the settle, so a fling coasts on into the
detent without turning back; anything else takes the paged-strip
settle (base). Reduced motion lands on it.
pub fn land(&mut self, target: Vec2)
pub fn land(&mut self, target: Vec2)
Show target on the next frame: keyboard focus moving to a control
off screen while tabbing.
pub fn take_over(&mut self, now: Instant) -> Option<Vec2>
pub fn take_over(&mut self, now: Instant) -> Option<Vec2>
The hand takes over (a wheel, a finger, a bar drag): the motion stops where the content is drawn. Returns that offset when a glide was under way.
pub fn offset(&self, now: Instant) -> Option<Vec2>
pub fn offset(&self, now: Instant) -> Option<Vec2>
Where the content is drawn at now while it glides; None when the
scroller’s own offset is where it is.
pub fn offset_in_device_pixels(
&self,
now: Instant,
device_per_unit: f64,
) -> Option<Vec2>
pub fn offset_in_device_pixels( &self, now: Instant, device_per_unit: f64, ) -> Option<Vec2>
Self::offset in whole pixels of a display with device_per_unit
device pixels per logical pixel; the target itself where it rests.
pub fn opacity(&self, now: Instant) -> f32
pub fn opacity(&self, now: Instant) -> f32
The content’s opacity at now: below 1 while it fades in after a
long jump.
pub fn is_gliding(&self, now: Instant) -> bool
pub fn is_gliding(&self, now: Instant) -> bool
Whether the content still glides at now; once it arrives, the
scroller’s offset is the target and the motion asks for nothing.
pub fn is_moving(&self, now: Instant) -> bool
pub fn is_moving(&self, now: Instant) -> bool
Whether anything still moves at now: the glide or the fade-in.
pub fn settles_at(&self) -> Option<Instant>
pub fn settles_at(&self) -> Option<Instant>
When everything has arrived; None at rest.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ScrollTo
impl RefUnwindSafe for ScrollTo
impl Send for ScrollTo
impl Sync for ScrollTo
impl Unpin for ScrollTo
impl UnsafeUnpin for ScrollTo
impl UnwindSafe for ScrollTo
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> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> DowncastSync for T
impl<T> DowncastSync 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