pub struct ListWindow {
pub estimated_item_height: f32,
pub overscan: usize,
pub gap: f32,
pub scroll_offset: f32,
/* private fields */
}Fields§
§estimated_item_height: f32§overscan: usize§gap: f32§scroll_offset: f32Implementations§
Source§impl ListWindow
impl ListWindow
pub fn new(estimated_item_height: f32, overscan: usize, gap: f32) -> ListWindow
Sourcepub fn record(&mut self, key: &str, height: f32) -> bool
pub fn record(&mut self, key: &str, height: f32) -> bool
Remember one row’s laid-out height. Returns true when it changed.
Sourcepub fn estimate(&self) -> f32
pub fn estimate(&self) -> f32
The extent of an unmeasured item (item_extents): the mean
measured extent once any item was measured (keeps the scroll extent
stable, so a fling lands on the real end in one pass), else
estimated_item_height (the theme’s $control.row, round 2 §5).
Sourcepub fn measured_mean(&self) -> Option<f32>
pub fn measured_mean(&self) -> Option<f32>
The mean measured extent (None before the first pass).
Sourcepub fn extents<'a>(&self, keys: impl Iterator<Item = &'a str>) -> Vec<f64>
pub fn extents<'a>(&self, keys: impl Iterator<Item = &'a str>) -> Vec<f64>
Every item’s extent in key order (measured, else the estimate).
pub fn height_of(&self, key: &str) -> f32
pub fn forget(&mut self, key: &str)
pub fn clear(&mut self)
Sourcepub fn offsets_cached(&mut self, keys: &Arc<Vec<String>>) -> Arc<Vec<f32>> ⓘ
pub fn offsets_cached(&mut self, keys: &Arc<Vec<String>>) -> Arc<Vec<f32>> ⓘ
Self::offsets memoized per keys list (by identity) until a height
or the gap changes: a scroll step reuses them (O(log n) per step).
Sourcepub fn sticky_header_cached(
&mut self,
keys: &Arc<Vec<String>>,
header_rows: &[usize],
scroll: f64,
) -> Option<(StickyHeader, f64)>
pub fn sticky_header_cached( &mut self, keys: &Arc<Vec<String>>, header_rows: &[usize], scroll: f64, ) -> Option<(StickyHeader, f64)>
The pinned header (sticky_header) on the memoized offsets
(Self::offsets_cached): a row’s extent = the next offset − the
gap, so nothing per row is recomputed. Header rows past the keys are
ignored; header_rows ascending. Returns the pin and the row’s own
offset.
Sourcepub fn offsets<'a>(&self, keys: impl Iterator<Item = &'a str>) -> Vec<f32>
pub fn offsets<'a>(&self, keys: impl Iterator<Item = &'a str>) -> Vec<f32>
Offsets of every row’s top plus the total height at the end. Linear in the row count (one pass, no allocation per row beyond the output); the surface calls it once per layout pass.
Sourcepub fn content_height<'a>(&self, keys: impl Iterator<Item = &'a str>) -> f32
pub fn content_height<'a>(&self, keys: impl Iterator<Item = &'a str>) -> f32
Total content height for count rows (estimated where unmeasured).
Sourcepub fn visible_range(&self, offsets: &[f32], viewport: f32) -> VisibleRange
pub fn visible_range(&self, offsets: &[f32], viewport: f32) -> VisibleRange
The items to lay out for a viewport of viewport (on the list’s
axis) at the current scroll offset, overscan on both ends: every item
intersecting [scroll, scroll + viewport) (an item ending exactly at
scroll counts), virtual_window on memoized offsets, O(log n).
offsets = Self::offsets.