SpatialAlignment

interface SpatialAlignment

Known direct subclasses
SpatialBiasAbsoluteAlignment

An SpatialAbsoluteAlignment specified by bias

SpatialBiasAlignment

Creates a weighted alignment that specifies a horizontal, vertical, and depth bias.


An interface to calculate the position of a sized box inside of an available 3D space. SpatialAlignment is often used to define the alignment of a layout inside a parent layout.

Summary

Nested types

An interface to calculate the position of a box of a certain depth inside an available depth.

An interface to calculate the position of a box of a certain width inside an available width.

An interface to calculate the position of a box of a certain height inside an available height.

Public functions

Int
depthOffset(depth: Int, space: Int)

Provides the depth offset from the origin of the space to the origin of the content.

Int
horizontalOffset(width: Int, space: Int, layoutDirection: LayoutDirection)

Provides the horizontal offset from the origin of the space to the origin of the content.

Vector3
position(
    size: IntVolumeSize,
    space: IntVolumeSize,
    layoutDirection: LayoutDirection
)

Provides the origin-based position of the content in the available space.

Int
verticalOffset(height: Int, space: Int)

Provides the vertical offset from the origin of the space to the origin of the content.

Public companion properties

BottomCenter

Added in 1.0.0-alpha07
val BottomCenterSpatialAlignment

BottomEnd

Added in 1.0.0-alpha07
val BottomEndSpatialAlignment

BottomLeft

Added in 1.0.0-alpha07
Deprecated in 1.0.0-alpha07
val BottomLeftSpatialAlignment

BottomRight

Added in 1.0.0-alpha07
Deprecated in 1.0.0-alpha07
val BottomRightSpatialAlignment

BottomStart

Added in 1.0.0-alpha07
val BottomStartSpatialAlignment

Center

Added in 1.0.0-alpha07
val CenterSpatialAlignment

CenterDepthwise

Added in 1.0.0-alpha07
val CenterDepthwiseSpatialAlignment.Depth

CenterEnd

Added in 1.0.0-alpha07
val CenterEndSpatialAlignment

CenterHorizontally

Added in 1.0.0-alpha07
val CenterHorizontallySpatialAlignment.Horizontal

CenterLeft

Added in 1.0.0-alpha07
Deprecated in 1.0.0-alpha07
val CenterLeftSpatialAlignment

CenterRight

Added in 1.0.0-alpha07
Deprecated in 1.0.0-alpha07
val CenterRightSpatialAlignment

CenterStart

Added in 1.0.0-alpha07
val CenterStartSpatialAlignment

CenterVertically

Added in 1.0.0-alpha07
val CenterVerticallySpatialAlignment.Vertical

Left

Added in 1.0.0-alpha07
Deprecated in 1.0.0-alpha07
val LeftSpatialAlignment.Horizontal

Right

Added in 1.0.0-alpha07
Deprecated in 1.0.0-alpha07
val RightSpatialAlignment.Horizontal

TopCenter

Added in 1.0.0-alpha07
val TopCenterSpatialAlignment

TopEnd

Added in 1.0.0-alpha07
val TopEndSpatialAlignment

TopLeft

Added in 1.0.0-alpha07
Deprecated in 1.0.0-alpha07
val TopLeftSpatialAlignment

TopRight

Added in 1.0.0-alpha07
Deprecated in 1.0.0-alpha07
val TopRightSpatialAlignment

TopStart

Added in 1.0.0-alpha07
val TopStartSpatialAlignment

Public functions

depthOffset

Added in 1.0.0-alpha07
fun depthOffset(depth: Int, space: Int): Int

Provides the depth offset from the origin of the space to the origin of the content.

Parameters
depth: Int

The content depth in pixels.

space: Int

The available space in pixels.

horizontalOffset

Added in 1.0.0-alpha07
fun horizontalOffset(
    width: Int,
    space: Int,
    layoutDirection: LayoutDirection = LayoutDirection.Ltr
): Int

Provides the horizontal offset from the origin of the space to the origin of the content.

Parameters
width: Int

The content width in pixels.

space: Int

The available space in pixels.

layoutDirection: LayoutDirection = LayoutDirection.Ltr

LTR or RTL.

position

Added in 1.0.0-alpha07
fun position(
    size: IntVolumeSize,
    space: IntVolumeSize,
    layoutDirection: LayoutDirection = LayoutDirection.Ltr
): Vector3

Provides the origin-based position of the content in the available space.

Parameters
size: IntVolumeSize

The content size in pixels.

space: IntVolumeSize

The available space in pixels.

layoutDirection: LayoutDirection = LayoutDirection.Ltr

LTR or RTL.

verticalOffset

Added in 1.0.0-alpha07
fun verticalOffset(height: Int, space: Int): Int

Provides the vertical offset from the origin of the space to the origin of the content.

Parameters
height: Int

The content height in pixels.

space: Int

The available space in pixels.