public interface SpatialAlignment
An interface to calculate the position of a sized box inside an available 3D space. SpatialAlignment is often used to define the alignment of a layout inside a parent layout.
Functions
align
public fun align(
size: IntVolumeSize,
space: IntVolumeSize,
layoutDirection: LayoutDirection,
): Vector3
Provides the origin-based position of the content in the available space.
Parameters
| size | The content size in pixels. |
| space | The available space in pixels. |
| layoutDirection | LTR or RTL. |
Members
Horizontal
public interface Horizontal
An interface to calculate the alignment of a box of a certain size inside an available width.
Functions
align
public fun align(size: Int, space: Int, layoutDirection: LayoutDirection): Int
Provides the horizontal alignment offset from the origin of the space to the origin of the content.
Parameters
| size | The content size in pixels. |
| space | The available space in pixels. |
| layoutDirection | LTR or RTL. |
Vertical
public interface Vertical
An interface to calculate the alignment of a box of a certain size inside an available height.
Functions
align
public fun align(size: Int, space: Int): Int
Provides the vertical alignment offset from the origin of the space to the origin of the content.
Parameters
| size | The content size in pixels. |
| space | The available space in pixels. |
Depth
public interface Depth
An interface to calculate the alignment of a box of a certain size inside an available depth.
Functions
align
public fun align(size: Int, space: Int): Int
Provides the depth alignment offset from the origin of the space to the origin of the content.
Parameters
| size | The content size in pixels. |
| space | The available space in pixels. |
Companion
public companion object
Properties
TopStart
@JvmStatic public val TopStart: SpatialAlignment = SpatialBiasAlignment(-1f, 1f, 0f)
TopCenter
@JvmStatic public val TopCenter: SpatialAlignment = SpatialBiasAlignment(0f, 1f, 0f)
TopEnd
@JvmStatic public val TopEnd: SpatialAlignment = SpatialBiasAlignment(1f, 1f, 0f)
CenterStart
@JvmStatic public val CenterStart: SpatialAlignment = SpatialBiasAlignment(-1f, 0f, 0f)
Center
@JvmStatic public val Center: SpatialAlignment = SpatialBiasAlignment(0f, 0f, 0f)
CenterEnd
@JvmStatic public val CenterEnd: SpatialAlignment = SpatialBiasAlignment(1f, 0f, 0f)
BottomStart
@JvmStatic public val BottomStart: SpatialAlignment = SpatialBiasAlignment(-1f, -1f, 0f)
BottomCenter
@JvmStatic public val BottomCenter: SpatialAlignment = SpatialBiasAlignment(0f, -1f, 0f)
BottomEnd
@JvmStatic public val BottomEnd: SpatialAlignment = SpatialBiasAlignment(1f, -1f, 0f)
Start
@JvmStatic public val Start: Horizontal = SpatialBiasAlignment.Horizontal(-1f)
CenterHorizontally
@JvmStatic public val CenterHorizontally: Horizontal = SpatialBiasAlignment.Horizontal(0f)
End
@JvmStatic public val End: Horizontal = SpatialBiasAlignment.Horizontal(1f)
Bottom
@JvmStatic public val Bottom: Vertical = SpatialBiasAlignment.Vertical(-1f)
CenterVertically
@JvmStatic public val CenterVertically: Vertical = SpatialBiasAlignment.Vertical(0f)
Top
@JvmStatic public val Top: Vertical = SpatialBiasAlignment.Vertical(1f)
Back
@JvmStatic public val Back: Depth = SpatialBiasAlignment.Depth(-1f)
CenterDepthwise
@JvmStatic public val CenterDepthwise: Depth = SpatialBiasAlignment.Depth(0f)
Front
@JvmStatic public val Front: Depth = SpatialBiasAlignment.Depth(1f)