Skip to main content

thumb_geometry

Function thumb_geometry 

Source
pub fn thumb_geometry(
    area: Rect,
    total_len: usize,
    visible_len: usize,
    offset: usize,
) -> Option<(u16, u16)>
Expand description

The thumb’s row span within area ((start, len), both relative to area.top()) for a vertical scrollbar covering total_len items in a visible_len-row viewport currently starting at offset.

None if there’s nothing to scroll (area has no rows, visible_len is zero, or total_len <= visible_len, the whole track already fits in the viewport). widget::Scrollbar falls back to drawing a plain, thumb-less track in that case.

The thumb is sized proportionally to visible_len / total_len (clamped to at least one row so it’s never invisible) and positioned proportionally to offset within the remaining scrollable range.