buildUniformCumX
Builds cumulative horizontal positions for equally sized items
Available since @roku-sdk/flex-grid 3.3.0
import { buildUniformCumX } from "@roku-sdk/flex-grid/geometry";Also exported as buildUniformCumX from @roku-sdk/flex-grid (deprecated).
Deprecated: buildUniformCumX. Import from @roku-sdk/flex-grid/geometry instead. The root export will be removed in the next major version.
buildUniformCumX(itemWidth: number, itemGap: number, numCols: number): number[]Description
Builds cumulative horizontal positions for equally sized items.
The final entry includes the trailing gap. Zero columns returns [0]. Sizes must be non-negative and the column count must be a non-negative integer.
Parameters
| Name | Type | Description |
|---|---|---|
itemWidth | number | Item width in pixels. |
itemGap | number | Gap after each item in pixels. |
numCols | number | Number of columns, as a non-negative integer. |
Return values
The item start positions in pixels followed by the total width including the trailing gap.
Example
buildUniformCumX(100, 10, 2); // [0, 110, 220]Updated about 3 hours ago
What’s Next
Did this page help you?