pub struct ScrollManager<V: View + Clone + Send + Sync + 'static> { /* private fields */ }Expand description
Virtual scroll manager with Ankurah LiveQuery integration
Implementations§
Source§impl<V: View + Clone + Send + Sync + 'static> ScrollManager<V>
impl<V: View + Clone + Send + Sync + 'static> ScrollManager<V>
Sourcepub fn new(
ctx: &Context,
predicate: impl TryInto<Predicate, Error = impl Debug>,
display_order: impl IntoOrderBy,
minimum_row_height: u32,
buffer_factor: f64,
viewport_height: u32,
) -> Result<Self, RetrievalError>
pub fn new( ctx: &Context, predicate: impl TryInto<Predicate, Error = impl Debug>, display_order: impl IntoOrderBy, minimum_row_height: u32, buffer_factor: f64, viewport_height: u32, ) -> Result<Self, RetrievalError>
Create a new scroll manager
§Arguments
ctx- Ankurah contextpredicate- Filter predicate (e.g.,"room_id = 'abc'")display_order- Visual order (e.g.,"timestamp DESC"for chat)minimum_row_height- Guaranteed minimum item height in pixelsbuffer_factor- Buffer as multiple of viewport (2.0 = 2x viewport buffer)viewport_height- Viewport height in pixels
Sourcepub async fn start(&self)
pub async fn start(&self)
Initialize the scroll manager (waits for initial query results) generally this should be backgrounded and not awaited on.
pub fn visible_set(&self) -> Read<VisibleSet<V>>
pub fn mode(&self) -> ScrollMode
Sourcepub fn current_selection(&self) -> String
pub fn current_selection(&self) -> String
Get the current selection (predicate + order by) as a string.
Sourcepub fn debug_info(&self) -> Read<ScrollDebugInfo>
pub fn debug_info(&self) -> Read<ScrollDebugInfo>
Get debug info about scroll position and buffer state
Sourcepub fn on_scroll(
&self,
first_visible: EntityId,
last_visible: EntityId,
scrolling_backward: bool,
)
pub fn on_scroll( &self, first_visible: EntityId, last_visible: EntityId, scrolling_backward: bool, )
Notify the scroll manager of visible item changes
§Arguments
first_visible- EntityId of the first (oldest) visible itemlast_visible- EntityId of the last (newest) visible itemscrolling_backward- True if user is scrolling toward older items
Auto Trait Implementations§
impl<V> !Freeze for ScrollManager<V>
impl<V> !RefUnwindSafe for ScrollManager<V>
impl<V> Send for ScrollManager<V>
impl<V> Sync for ScrollManager<V>
impl<V> Unpin for ScrollManager<V>where
V: Unpin,
impl<V> !UnwindSafe for ScrollManager<V>
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
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>
Converts
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>
Converts
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 moreSource§impl<T> StorageAccess<T> for T
impl<T> StorageAccess<T> for T
Source§fn as_borrowed(&self) -> &T
fn as_borrowed(&self) -> &T
Borrows the value.
Source§fn into_taken(self) -> T
fn into_taken(self) -> T
Takes the value.