Skip to main content

offset_for_pos

Function offset_for_pos 

Source
pub fn offset_for_pos(
    area: Rect,
    total_len: usize,
    visible_len: usize,
    pos: Pos,
) -> Option<usize>
Expand description

The offset a vertical scrollbar should jump to for a click/drag at pos.

Covers total_len items in a visible_len-row area; useful for click-to-jump or drag-to-scroll interactions built on top of thumb_geometry, whose exact inverse it is (both share the same private row/offset conversion internally). None if pos falls outside area, or (mirroring thumb_geometry) there’s nothing to scroll.