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
impl ScrollStore
pub fn is_empty(&self) -> bool
pub fn offset(&self, key: Key) -> Vec2
pub fn geometry(&self, key: Key) -> Option<ScrollGeometry>
Sourcepub fn scroll_by(&mut self, key: Key, delta: Vec2)
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.
Sourcepub fn scroll_by_smooth(&mut self, key: Key, delta: Vec2)
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.
pub fn set(&mut self, key: Key, offset: Vec2)
Sourcepub fn set_smooth(&mut self, key: Key, offset: Vec2)
pub fn set_smooth(&mut self, key: Key, offset: Vec2)
The same, from a programmatic source; see
scroll_by_smooth.
Sourcepub fn animating(&self) -> bool
pub fn animating(&self) -> bool
Whether an eased offset was still mid-flight at the last layout, so the driver owes another frame.
Sourcepub fn resolve(
&mut self,
key: Key,
rect: Rect,
content: Size,
max: Vec2,
smooth: Option<Transition>,
) -> Vec2
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
impl Default for ScrollStore
Source§fn default() -> ScrollStore
fn default() -> ScrollStore
Auto Trait Implementations§
impl !Freeze for ScrollStore
impl !RefUnwindSafe for ScrollStore
impl !Sync for ScrollStore
impl Send for ScrollStore
impl Unpin for ScrollStore
impl UnsafeUnpin for ScrollStore
impl UnwindSafe for ScrollStore
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> 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.