pub struct ScrollMetrics {
pub pixels: f32,
pub min: f32,
pub max: f32,
pub viewport: f32,
}Expand description
The state of one scroll axis, as the physics sees it. All in logical pixels.
pixels is the current offset, min/max the offsets the content may rest
at (min is 0 in practice, max the overflow), and viewport the visible
extent along that axis — the yardstick the rubber band is measured against.
Fields§
§pixels: f32The current scroll offset.
min: f32The smallest offset the content may rest at; 0 in practice.
max: f32The largest offset the content may rest at: how far the content overflows.
viewport: f32The visible extent along the axis.
Implementations§
Source§impl ScrollMetrics
impl ScrollMetrics
Sourcepub fn new(pixels: f32, max: f32, viewport: f32) -> Self
pub fn new(pixels: f32, max: f32, viewport: f32) -> Self
Metrics for an axis scrolling from 0 to max in a viewport-long window.
Sourcepub fn out_of_range(&self) -> bool
pub fn out_of_range(&self) -> bool
Is the offset outside the range the content may rest at?
Sourcepub fn overscroll_past(&self) -> f32
pub fn overscroll_past(&self) -> f32
How far past an edge the offset has been dragged; 0 while inside.
Trait Implementations§
Source§impl Clone for ScrollMetrics
impl Clone for ScrollMetrics
impl 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
Mutably borrows from an owned value. Read more