buildVariableCumX
Builds cumulative horizontal positions for items with different widths
Available since @roku-sdk/flex-grid 3.3.0
import { buildVariableCumX } from "@roku-sdk/flex-grid/geometry";Also exported as buildVariableCumX from @roku-sdk/flex-grid (deprecated).
Deprecated: buildVariableCumX. Import from @roku-sdk/flex-grid/geometry instead. The root export will be removed in the next major version.
buildVariableCumX(itemWidths: number[], itemGap: number): number[]Description
Builds cumulative horizontal positions for items with different widths.
The final entry includes the trailing gap. An empty width array returns [0]. Widths and the gap must be non-negative.
Parameters
| Name | Type | Description |
|---|---|---|
itemWidths | number[] | Item widths in pixels, in column order. |
itemGap | number | Gap after each item in pixels. |
Return values
The item start positions in pixels followed by the total width including the trailing gap.
Example
buildVariableCumX([100, 200], 10); // [0, 110, 320]Updated about 3 hours ago
What’s Next
Did this page help you?