Skip to content
Version 2.32.0
↓ Get the launcher

VariableListMath.TopVisibleIndex method

The topmost row at least partly under the viewport top: the first row whose BOTTOM edge (offsets[i+1]) is past scrollY, WITHOUT FirstIndex’s pool clamp (which pins the window to the final rows near the bottom, so its result can sit ABOVE the viewport). Walks from from (pass the window’s first row — the answer is never above it — to keep it O(window)); a from that is already past the view top walks back. −1 when count ≤ 0; a scroll past the content end returns the last row.

public static int TopVisibleIndex(float scrollY, float[] offsets, int count, int from)