SubspaceMeasurePolicy

fun interface SubspaceMeasurePolicy


Defines the measure and layout behavior of a SubspaceLayout.

SubspaceLayout and SubspaceMeasurePolicy are the way Compose XR layouts (such as SpatialBox, SpatialColumn, etc.) are built, and they can also be used to achieve custom layouts.

Based on androidx.compose.ui.layout.MeasurePolicy.

Summary

Public functions

SubspaceMeasureResult
SubspaceMeasureScope.measure(
    measurables: List<SubspaceMeasurable>,
    constraints: VolumeConstraints
)

The function that defines the measurement and layout.

Public functions

fun SubspaceMeasureScope.measure(
    measurables: List<SubspaceMeasurable>,
    constraints: VolumeConstraints
): SubspaceMeasureResult

The function that defines the measurement and layout. Each SubspaceMeasurable in the measurables list corresponds to a layout child of the layout, and children can be measured using the SubspaceMeasurable.measure method. This method takes the VolumeConstraints which the child should respect; different children can be measured with different constraints.

SubspaceMeasureResult objects are usually created using the SubspaceMeasureScope.layout factory, which takes the calculated size of this layout, its alignment lines, and a block defining the positioning of the children layouts.