Primitives / foldkit-primitives/state

visibleRange

function · packages/primitives/src/state/virtual.ts:118

function visibleRange(
  keys: ReadonlyArray<string>,
  heights: Readonly<Record<string, number>>,
  layout: VirtualLayout,
  scrollTop: number,
  viewportHeight: number,
  overscan: number,
): VirtualWindow

Which rows to render for a scroll position: the rows intersecting [scrollTop, scrollTop + viewportHeight), widened by overscan on both sides and clamped to [0, count]. Gaps and padding are dead space — no row — so boxes are tested, not cumulative coverage. An overscan of zero renders exactly the visible rows.