SubspacePlaceable.SubspacePlacementScope

abstract class SubspacePlaceable.SubspacePlacementScope


Receiver scope that permits explicit placement of a SubspacePlaceable.

Summary

Public constructors

Public functions

Unit

Place a SubspacePlaceable at the Pose in its parent's coordinate system.

Unit

Place a SubspacePlaceable at the Pose in its parent's coordinate system with auto mirrored position along YZ plane if parent layout direction is LayoutDirection.Rtl.

Public properties

open SubspaceLayoutCoordinates?

The SubspaceLayoutCoordinates of this layout, if known or null if the layout hasn't been placed yet.

Protected properties

abstract LayoutDirection

Keeps the layout direction of the parent of the subspace placeable that is being placed using current SubspacePlacementScope.

Public constructors

SubspacePlacementScope

Added in 1.0.0-alpha11
SubspacePlacementScope()

Public functions

fun SubspacePlaceable.place(pose: Pose): Unit

Place a SubspacePlaceable at the Pose in its parent's coordinate system.

Parameters
pose: Pose

The pose of the layout.

placeRelative

fun SubspacePlaceable.placeRelative(pose: Pose): Unit

Place a SubspacePlaceable at the Pose in its parent's coordinate system with auto mirrored position along YZ plane if parent layout direction is LayoutDirection.Rtl.

If the parentLayoutDirection is LayoutDirection.Rtl, this function calculates a new pose by mirroring the original pose across the YZ plane. This ensures that layouts designed for LTR behave intuitively when the locale is switched to RTL.

The mirroring transformation involves:

  1. Translation: The x component of the translation vector is negated (x -> -x). This moves the object from the right side to the left side, or vice versa.

  2. Rotation: The y and z components of the underlying quaternion are negated. This has the effect of reversing the direction of yaw (rotation around the Y-axis) and roll (rotation around the Z-axis), while leaving pitch (rotation around the X-axis) unchanged.

For example, a pose that places an object 20 dp to the left and yawed 30 degrees to the right will be transformed to place the object 20 dp to the right and yawed 30 degrees to the left.

If the layout direction is LTR, the original pose is used without modification.

This API is not mirroring the internal mesh geometry of 3D models. This function only affects pose of the layout.

Parameters
pose: Pose

The pose of the layout.

Public properties

coordinates

Added in 1.0.0-alpha11
open val coordinatesSubspaceLayoutCoordinates?

The SubspaceLayoutCoordinates of this layout, if known or null if the layout hasn't been placed yet.

Protected properties

parentLayoutDirection

Added in 1.0.0-alpha11
protected abstract val parentLayoutDirectionLayoutDirection

Keeps the layout direction of the parent of the subspace placeable that is being placed using current SubspacePlacementScope. Used to support automatic position mirroring for convenient RTL support in custom layouts.