pub struct LayoutScrollArea { /* private fields */ }Implementations§
Source§impl LayoutScrollArea
impl LayoutScrollArea
pub fn new( layout_style: LayoutStyle, content: Box<dyn LayoutItem>, ) -> Result<LayoutScrollArea, LayoutError>
Sourcepub fn new_with<F>(
layout_style: LayoutStyle,
build: F,
) -> Result<LayoutScrollArea, LayoutError>
pub fn new_with<F>( layout_style: LayoutStyle, build: F, ) -> Result<LayoutScrollArea, LayoutError>
Like new, but the content is built with access to this scroll’s live
ScrollViewport, so descendants can gate work (e.g. lazy asset loading) on whether they are
currently on screen. The offset/viewport signals are created BEFORE build runs, so the content
it returns can capture them — resolving the ordering bind where the scroll is built from its own
content yet the content needs the scroll’s signals.
Sourcepub fn new_kept<F>(
key: &'static str,
layout_style: LayoutStyle,
build: F,
) -> Result<LayoutScrollArea, LayoutError>
pub fn new_kept<F>( key: &'static str, layout_style: LayoutStyle, build: F, ) -> Result<LayoutScrollArea, LayoutError>
A scroll area whose position the surface keeps under key, so it survives a rebuild of the tree.
The usual spelling of new_keeping: a remounted view — a shell following a
config edit, a page rebuilt under the same window — reopens where the reader left it instead of
snapping to the top. key names this viewport among everything else the surface keeps, so two scroll
areas on one surface need two keys (see kept).
Sourcepub fn new_keeping<F>(
layout_style: LayoutStyle,
offset: (RwSignal<f32>, RwSignal<f32>),
build: F,
) -> Result<LayoutScrollArea, LayoutError>
pub fn new_keeping<F>( layout_style: LayoutStyle, offset: (RwSignal<f32>, RwSignal<f32>), build: F, ) -> Result<LayoutScrollArea, LayoutError>
Like new_with, but against offset signals the caller owns — so the scroll
position can outlive this widget.
For a tree that is rebuilt while its surface stays (a shell following a config edit, a view remounted
under the same window): a scroll area built with fresh signals starts at the top every time, which
reads as the list jumping back under the reader’s hands. Hand it the same pair on every build and the
view is where they left it. new_kept is this with the surface holding the pair.
pub fn clamp_scroll(&mut self)
Sourcepub fn scroll_to_top(&mut self)
pub fn scroll_to_top(&mut self)
Resets the scroll offset to the top-left, e.g. when swapping the content shown in the viewport.
pub fn viewport_rect(&self) -> Rect
Trait Implementations§
Source§impl Component for LayoutScrollArea
impl Component for LayoutScrollArea
fn view(&self) -> RenderNode
fn on_event(&mut self, event: &Event) -> EventResult
Source§fn debug_name(&self) -> &'static str
fn debug_name(&self) -> &'static str
Source§impl Drop for LayoutScrollArea
impl Drop for LayoutScrollArea
Auto Trait Implementations§
impl !RefUnwindSafe for LayoutScrollArea
impl !Send for LayoutScrollArea
impl !Sync for LayoutScrollArea
impl !UnwindSafe for LayoutScrollArea
impl Freeze for LayoutScrollArea
impl Unpin for LayoutScrollArea
impl UnsafeUnpin for LayoutScrollArea
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.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more