pub struct VirtualScroll {
pub item_height: f32,
pub viewport_height: f32,
pub scroll_offset: f32,
pub overscan: usize,
}Expand description
Configuration for windowed rendering of a fixed-height-item list.
Set via NodeRef::virtual_scroll.
Fields§
§item_height: f32Height (in the backend’s own units — px for DOM/canvas) of a single item.
viewport_height: f32Height of the scrollable viewport.
scroll_offset: f32Current scroll position, measured from the top of the full (unvirtualized) list. Backends update this from their own scroll event and feed it back in on the next render.
overscan: usizeExtra items rendered above/below the visible window to avoid a blank flash during fast scrolling.
Implementations§
Source§impl VirtualScroll
impl VirtualScroll
pub fn new(item_height: f32, viewport_height: f32) -> Self
pub fn with_offset(self, offset: f32) -> Self
pub fn with_overscan(self, overscan: usize) -> Self
Sourcepub fn visible_range(&self, total_items: usize) -> VisibleRange
pub fn visible_range(&self, total_items: usize) -> VisibleRange
Computes which item indices (of total_items) fall within the
viewport plus overscan, and the pixel-height spacers needed above/
below that window so the scrollable area’s total height (and thus
scrollbar behavior) still matches the full, unvirtualized list.
Trait Implementations§
Source§impl Clone for VirtualScroll
impl Clone for VirtualScroll
Source§fn clone(&self) -> VirtualScroll
fn clone(&self) -> VirtualScroll
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for VirtualScroll
Source§impl Debug for VirtualScroll
impl Debug for VirtualScroll
Source§impl<'de> Deserialize<'de> for VirtualScroll
impl<'de> Deserialize<'de> for VirtualScroll
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for VirtualScroll
impl PartialEq for VirtualScroll
Source§impl Serialize for VirtualScroll
impl Serialize for VirtualScroll
impl StructuralPartialEq for VirtualScroll
Auto Trait Implementations§
impl Freeze for VirtualScroll
impl RefUnwindSafe for VirtualScroll
impl Send for VirtualScroll
impl Sync for VirtualScroll
impl Unpin for VirtualScroll
impl UnsafeUnpin for VirtualScroll
impl UnwindSafe for VirtualScroll
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