Raxol.UI.Layout.Grid (Raxol v0.2.0)
View SourceHandles layout calculations for grid UI elements.
This module is responsible for:
- Grid-based layout calculations
- Cell sizing and positioning
- Column and row spanning elements
- Grid-specific spacing and constraints
Summary
Functions
Creates grid cell information for a grid layout.
Calculates the position for a cell in the grid.
Measures the space needed by a grid element.
Processes a grid element, calculating layout for it and its children.
Functions
Creates grid cell information for a grid layout.
Parameters
grid_attrs- The grid attributesspace- The available space
Returns
A map containing cell dimensions and grid information.
Calculates the position for a cell in the grid.
Parameters
col- The column index (0-based)row- The row index (0-based)grid_cells- The grid cell information fromcalculate_grid_cells/2space- The base space for the grid
Returns
A space map with x, y, width, and height for the cell.
Measures the space needed by a grid element.
Parameters
grid- The grid element to measureavailable_space- The available space for the grid
Returns
The dimensions of the grid: %{width: w, height: h}
Processes a grid element, calculating layout for it and its children.
Parameters
grid- The grid element to processspace- The available space for the gridacc- The accumulator for rendered elements
Returns
A list of positioned elements with absolute coordinates.