Skip to content
Version 2.32.0
↓ Get the launcher

VariableListMath.FirstIndex method

First (topmost) logical row to render given the vertical scroll offset (px from the content top) and the cumulative offsets (as filled by BuildOffsets). Returns the first row whose BOTTOM edge (offsets[i+1]) is past scrollY — i.e. the first at-least-partially-visible row — then clamps the window [first, first+poolSize) so it never runs past the end: first ≤ count − poolSize, so scrolling to the bottom always renders the FINAL poolSize rows (the newest). count ≤ poolSize ⇒ 0 (everything fits the pool).

public static int FirstIndex(float scrollY, float[] offsets, int count, int poolSize)