buildCumY

Builds cumulative vertical positions for rows with different heights

Available since @roku-sdk/flex-grid 3.3.0

import { buildCumY } from "@roku-sdk/flex-grid/geometry";

Also exported as buildCumY from @roku-sdk/flex-grid (deprecated).

Deprecated: buildCumY. Import from @roku-sdk/flex-grid/geometry instead. The root export will be removed in the next major version.

buildCumY(rowHeights: number[], rowGap: number): number[]

Description

Builds cumulative vertical positions for rows with different heights.

Rows with zero height contribute no gap. An empty height array returns [0]. Heights and the gap must be non-negative. The final entry includes the gap after the last non-empty row.

Parameters

NameTypeDescription
rowHeightsnumber[]Row heights in pixels, in data-row order.
rowGapnumberGap after each non-empty row in pixels.

Return values

The row start positions in pixels followed by the total extent including any trailing gap.

Example

buildCumY([100, 0, 200], 10); // [0, 110, 110, 320]

What’s Next

Did this page help you?