pub struct ScrollableController { /* private fields */ }Expand description
Holds the state for a scrollable component, managing scroll position and
interaction.
It tracks the current and target scroll positions, the size of the scrollable content, and focus state.
The scroll position is smoothly interpolated over time to create a fluid scrolling effect.
Implementations§
Source§impl ScrollableController
impl ScrollableController
Sourcepub fn child_position(&self) -> PxPosition
pub fn child_position(&self) -> PxPosition
Returns the current child position relative to the scrollable container.
This is primarily useful for components that need to implement custom virtualization strategies (e.g. lazy lists) and must know the current scroll offset. Values are clamped by the scroll logic, so consumers can safely derive their offset from the returned position.
Sourcepub fn is_positioned(&self) -> bool
pub fn is_positioned(&self) -> bool
Returns whether this viewport has been positioned by scrolling yet.
A freshly created controller reports false. Any scroll input,
programmatic position or animation marks it as positioned, so
consumers can distinguish an untouched viewport from one that
currently sits at the top.
Sourcepub fn visible_size(&self) -> ComputedData
pub fn visible_size(&self) -> ComputedData
Returns the currently visible viewport size of the scrollable container.
Sourcepub fn override_child_size(&mut self, size: ComputedData)
pub fn override_child_size(&mut self, size: ComputedData)
Overrides the child size used for scroll extent calculation.
The new extent is immediately available to scrolling and scrollbars.
Sourcepub fn set_scroll_position(&mut self, position: PxPosition)
pub fn set_scroll_position(&mut self, position: PxPosition)
Instantly sets the scroll position without animation.
This is useful for restoring a saved scroll position when remounting a component.
Trait Implementations§
Source§impl Clone for ScrollableController
impl Clone for ScrollableController
Source§fn clone(&self) -> ScrollableController
fn clone(&self) -> ScrollableController
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Default for ScrollableController
impl Default for ScrollableController
Source§impl PartialEq for ScrollableController
impl PartialEq for ScrollableController
impl StructuralPartialEq for ScrollableController
Auto Trait Implementations§
impl Freeze for ScrollableController
impl RefUnwindSafe for ScrollableController
impl Send for ScrollableController
impl Sync for ScrollableController
impl Unpin for ScrollableController
impl UnsafeUnpin for ScrollableController
impl UnwindSafe for ScrollableController
Blanket Implementations§
§impl<T> AnyEq for T
impl<T> AnyEq for T
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,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§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.§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.§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.§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.§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§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>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.§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>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.§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.§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.