pub struct ScrollMetrics {
pub pixels: f64,
pub min_scroll_extent: f64,
pub max_scroll_extent: f64,
pub viewport_dimension: f64,
pub device_pixel_ratio: f64,
}Expand description
A read-only snapshot of a scroll surface’s extent/position, the argument
every ScrollPhysics method reasons over (Flutter’s ScrollMetrics).
min_scroll_extent is carried for parity/chaining even though frust’s
scroll surfaces always run it at 0.0 today — nothing in this crate
produces a nonzero value yet.
Fields§
§pixels: f64The current scroll position (px scrolled down/along the axis).
min_scroll_extent: f64The minimum in-range position. Always 0.0 in this crate today.
max_scroll_extent: f64The maximum in-range position (content − viewport, never negative).
viewport_dimension: f64The visible extent along the scroll axis.
device_pixel_ratio: f64The device’s logical-to-physical pixel scale, feeding
Tolerance::for_device_pixel_ratio.
Implementations§
Source§impl ScrollMetrics
impl ScrollMetrics
Sourcepub fn out_of_range(&self) -> bool
pub fn out_of_range(&self) -> bool
Whether pixels currently sits outside [min_scroll_extent, max_scroll_extent].
Sourcepub fn overscroll_past_leading(&self) -> f64
pub fn overscroll_past_leading(&self) -> f64
How far past the leading (top/start) edge pixels currently sits,
0.0 if not past it.
Sourcepub fn overscroll_past_trailing(&self) -> f64
pub fn overscroll_past_trailing(&self) -> f64
How far past the trailing (bottom/end) edge pixels currently sits,
0.0 if not past it.
Trait Implementations§
Source§impl Clone for ScrollMetrics
impl Clone for ScrollMetrics
Source§fn clone(&self) -> ScrollMetrics
fn clone(&self) -> ScrollMetrics
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for ScrollMetrics
Source§impl Debug for ScrollMetrics
impl Debug for ScrollMetrics
Source§impl PartialEq for ScrollMetrics
impl PartialEq for ScrollMetrics
impl StructuralPartialEq for ScrollMetrics
Auto Trait Implementations§
impl Freeze for ScrollMetrics
impl RefUnwindSafe for ScrollMetrics
impl Send for ScrollMetrics
impl Sync for ScrollMetrics
impl Unpin for ScrollMetrics
impl UnsafeUnpin for ScrollMetrics
impl UnwindSafe for ScrollMetrics
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§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.Source§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.Source§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.Source§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.