#[repr(C)]pub struct ScrollState {
pub scroll_position: LogicalPosition,
}Expand description
Current scroll position for a single scroll frame.
Fields§
§scroll_position: LogicalPositionAmount in pixel that the current node is scrolled
Implementations§
Source§impl ScrollState
impl ScrollState
Sourcepub const fn get(&self) -> LogicalPosition
pub const fn get(&self) -> LogicalPosition
Return the current position of the scroll state
Sourcepub fn add(&mut self, x: f32, y: f32, max_scroll_rect: &LogicalRect)
pub fn add(&mut self, x: f32, y: f32, max_scroll_rect: &LogicalRect)
Add a scroll X / Y onto the existing scroll state.
max_scroll_rect is the scroll range rect: its size is the maximum
scrollable offset (content − viewport, clamped to >= 0), NOT the full
content size. See ScrollStates::scroll_node. Clamping via .max(0.0)
first also collapses any NaN input to 0.0 (f32::max returns the
non-NaN operand), so a NaN delta can never poison the scroll position.
Sourcepub const fn set(&mut self, x: f32, y: f32, max_scroll_rect: &LogicalRect)
pub const fn set(&mut self, x: f32, y: f32, max_scroll_rect: &LogicalRect)
Set the scroll state to a new position.
max_scroll_rect is the scroll range rect (see ScrollState::add).
Trait Implementations§
Source§impl Clone for ScrollState
impl Clone for ScrollState
Source§fn clone(&self) -> ScrollState
fn clone(&self) -> ScrollState
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for ScrollState
Source§impl Debug for ScrollState
impl Debug for ScrollState
Source§impl Default for ScrollState
impl Default for ScrollState
impl Eq for ScrollState
Source§impl PartialEq for ScrollState
impl PartialEq for ScrollState
Source§impl PartialOrd for ScrollState
impl PartialOrd for ScrollState
impl StructuralPartialEq for ScrollState
Auto Trait Implementations§
impl Freeze for ScrollState
impl RefUnwindSafe for ScrollState
impl Send for ScrollState
impl Sync for ScrollState
impl Unpin for ScrollState
impl UnsafeUnpin for ScrollState
impl UnwindSafe for ScrollState
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