SpatialBiasAbsoluteAlignment

class SpatialBiasAbsoluteAlignment : SpatialAlignment


Positions content in 3D space using horizontal, vertical, and depth bias.

Bias refers to a normalized floating-point value, typically within the range of -1.0f, 1.0f, that determines how a child's content is positioned along a specific axis relative to its parent's available space.

  • A bias of 0.0f centers the content along that axis.

  • A bias of -1.0f aligns the content to one extreme (e.g., left for horizontal, bottom for vertical, back for depth).

  • A bias of 1.0f aligns the content to the opposite extreme (e.g., right for horizontal, top for vertical, front for depth).

  • Values between -1.0f and 1.0f linearly interpolate the position between these extremes.

Unlike SpatialBiasAlignment, the horizontalBias in this alignment is absolute; -1.0f always means left and 1.0f` always means right, irrespective of the current LayoutDirection.

Summary

Nested types

Creates a weighted alignment that specifies a horizontal bias and independent of layout direction

Public constructors

SpatialBiasAbsoluteAlignment(
    horizontalBias: @FloatRange(from = -1.0, to = 1.0) Float,
    verticalBias: @FloatRange(from = -1.0, to = 1.0) Float,
    depthBias: @FloatRange(from = -1.0, to = 1.0) Float
)

Public functions

SpatialBiasAbsoluteAlignment
copy(horizontalBias: Float, verticalBias: Float, depthBias: Float)
open Int
depthOffset(depth: Int, space: Int)

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

open operator Boolean
equals(other: Any?)
open Int
open Int
horizontalOffset(width: Int, space: Int, layoutDirection: LayoutDirection)

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

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

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

open String
open Int
verticalOffset(height: Int, space: Int)

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

Public properties

Float

Must be within the range of -1, 1 with -1 being back and 1 being front.

Float

Must be within the range of -1, 1 with -1 being left and 1 being right.

Float

Must be within the range of -1, 1 with -1 being bottom and 1 being top.

Public constructors

SpatialBiasAbsoluteAlignment

Added in 1.0.0-alpha13
SpatialBiasAbsoluteAlignment(
    horizontalBias: @FloatRange(from = -1.0, to = 1.0) Float,
    verticalBias: @FloatRange(from = -1.0, to = 1.0) Float,
    depthBias: @FloatRange(from = -1.0, to = 1.0) Float
)
Parameters
horizontalBias: @FloatRange(from = -1.0, to = 1.0) Float

Must be within the range of -1, 1 with -1 being left and 1 being right.

verticalBias: @FloatRange(from = -1.0, to = 1.0) Float

Must be within the range of -1, 1 with -1 being bottom and 1 being top.

depthBias: @FloatRange(from = -1.0, to = 1.0) Float

Must be within the range of -1, 1 with -1 being back and 1 being front.

Public functions

copy

Added in 1.0.0-alpha13
fun copy(
    horizontalBias: Float = this.horizontalBias,
    verticalBias: Float = this.verticalBias,
    depthBias: Float = this.depthBias
): SpatialBiasAbsoluteAlignment

depthOffset

open 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.

equals

open operator fun equals(other: Any?): Boolean

hashCode

open fun hashCode(): Int

horizontalOffset

open fun horizontalOffset(width: Int, space: Int, layoutDirection: LayoutDirection): 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

LTR or RTL.

position

open fun position(
    size: IntVolumeSize,
    space: IntVolumeSize,
    layoutDirection: LayoutDirection
): 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

LTR or RTL.

toString

open fun toString(): String

verticalOffset

open 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.

Public properties

depthBias

Added in 1.0.0-alpha13
val depthBiasFloat

Must be within the range of -1, 1 with -1 being back and 1 being front.

horizontalBias

Added in 1.0.0-alpha13
val horizontalBiasFloat

Must be within the range of -1, 1 with -1 being left and 1 being right.

verticalBias

Added in 1.0.0-alpha13
val verticalBiasFloat

Must be within the range of -1, 1 with -1 being bottom and 1 being top.