Skip to main content

ScrollStore

Struct ScrollStore 

Source
pub struct ScrollStore { /* private fields */ }
Expand description

The retained scroll state of one window, owned by Core. Reach it through Core::scroll_offset, Core::set_scroll and Core::scroll_geometry rather than directly.

Implementations§

Source§

impl ScrollStore

Source

pub fn len(&self) -> usize

How many entries are retained, declared and undeclared together.

Source

pub fn is_empty(&self) -> bool

Source

pub fn offset(&self, key: Key) -> Vec2

Source

pub fn geometry(&self, key: Key) -> Option<ScrollGeometry>

Source

pub fn scroll_by(&mut self, key: Key, delta: Vec2)

Adds a delta (positive = scroll content further down/right). Clamping happens in the next layout pass.

Source

pub fn scroll_by_smooth(&mut self, key: Key, delta: Vec2)

The same, from a programmatic source — a reveal, an app’s set_scroll — which a container declaring a transition eases into rather than jumping.

Source

pub fn set(&mut self, key: Key, offset: Vec2)

Source

pub fn set_smooth(&mut self, key: Key, offset: Vec2)

The same, from a programmatic source; see scroll_by_smooth.

Source

pub fn animating(&self) -> bool

Whether an eased offset was still mid-flight at the last layout, so the driver owes another frame.

Source

pub fn resolve( &mut self, key: Key, rect: Rect, content: Size, max: Vec2, smooth: Option<Transition>, ) -> Vec2

What layout calls on a scroll container: records the geometry it resolved, clamps the stored offset to [0, max] per axis, and returns it. max is passed rather than derived from rect and content because an axis that does not scroll has no travel however far its content overflows.

Trait Implementations§

Source§

impl Default for ScrollStore

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.