Function

movable

When the movable modifier is present and enabled, draggable UI controls will be shown that allow the user to move the element in 3D space.

movable

Source set: Android
public fun SubspaceModifier.movable(
    enabled: Boolean = true,
    stickyPose: Boolean = false,
    scaleWithDistance: Boolean = true,
    onMoveStart: ((SpatialMoveEvent) -> Unit)? = null,
    onMoveEnd: ((SpatialMoveEvent) -> Unit)? = null,
    onMove: ((SpatialMoveEvent) -> Boolean)? = null,
): SubspaceModifier

When the movable modifier is present and enabled, draggable UI controls will be shown that allow the user to move the element in 3D space.

There are some limitations that should be considered when using this modifier: 1) the draggable UI controls of nested composables using the movable modifier may conflict with each other, 2) when attaching multiple movable modifiers that handle movement internally, the movement effect will be compounded.

Parameters

enabled true if this composable should be movable.
stickyPose if enabled, the user specified position will be retained when the modifier is disabled or removed.
scaleWithDistance true if this composable should scale in size when moved in depth. When this scaleWithDistance is enabled, the subspace element moved will grow or shrink. It will also maintain any explicit scale that it had before movement.
onMoveStart a callback to process the start of a move event. This will only be called if enabled is true.
onMoveEnd a callback to process the end of a move event. This will only be called if enabled is true.
onMove a callback to process the pose change during movement, with translation in pixels. This will only be called if enabled is true. If the callback returns false the default behavior of moving this composable's subspace hierarchy will be executed. If it returns true, it is the responsibility of the callback to process the event.

Last updated: