The 2D layer · function

visibleRangeVariable

Variable row heights, through a prefix-sum table of row tops the caller owns.

Explained in Sprites and tilemaps.

function visibleRangeVariable(scrollY: number, viewHeight: number, offsets: Float64Array, rowCount: number, overscan: number): RowWindow
import { visibleRangeVariable } from '@driftengine/ui2d';

Parameters

ParameterTypeDescription
scrollYnumber
viewHeightnumber
offsetsFloat64Array
rowCountnumber
overscannumber

In depth

The caller owns the table because only the caller knows when a row's height changed, and recomputing it here every frame would be the cost this module exists to avoid. offsets holds rowCount + 1 entries: the top of each row, then the bottom of the last.