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): RowWindowimport { visibleRangeVariable } from '@driftengine/ui2d';Parameters
| Parameter | Type | Description |
|---|---|---|
scrollY | number | |
viewHeight | number | |
offsets | Float64Array | |
rowCount | number | |
overscan | number |
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.