SpatialInputEvent

class SpatialInputEvent


Defines Spatial input events for Compose, representing a user's input in 3D space. These are fired when an InteractionPolicy is attached to a Composable.

Summary

Public constructors

SpatialInputEvent(
    source: InputEvent.Source,
    pointerType: InputEvent.Pointer,
    action: InputEvent.Action,
    timestamp: Long,
    hitPosition: Vector3?,
    origin: Vector3,
    direction: Vector3
)

Public functions

open operator Boolean
equals(other: Any?)
open Int
open String

Public properties

InputEvent.Action

Actions similar to Android's MotionEvent for keeping track of a sequence of events on the same target, e.g., HOVER_ENTER -> HOVER_MOVE -> HOVER_EXIT, DOWN -> MOVE -> UP.

Vector3

A point indicating the direction the ray is pointing, in the receiver's activity space, in pixels.

Vector3?

The offset of the point of interaction, in pixels, relative to the center of the Composable this input targets.

Vector3

The origin of the ray in the receiver's activity space, in pixels.

InputEvent.Pointer

Type of the individual pointer (e.g. left, right or default) for this event.

InputEvent.Source

Type of source (e.g. hands, controller, head) that generated this event.

Long

Timestamp from SystemClock.uptimeMillis time base.

Public constructors

SpatialInputEvent

Added in 1.0.0-alpha09
SpatialInputEvent(
    source: InputEvent.Source,
    pointerType: InputEvent.Pointer,
    action: InputEvent.Action,
    timestamp: Long,
    hitPosition: Vector3?,
    origin: Vector3,
    direction: Vector3
)
Parameters
source: InputEvent.Source

Type of source (e.g. hands, controller, head) that generated this event.

pointerType: InputEvent.Pointer

Type of the individual pointer (e.g. left, right or default) for this event.

action: InputEvent.Action

Actions similar to Android's MotionEvent for keeping track of a sequence of events on the same target, e.g., HOVER_ENTER -> HOVER_MOVE -> HOVER_EXIT, DOWN -> MOVE -> UP.

timestamp: Long

Timestamp from SystemClock.uptimeMillis time base.

hitPosition: Vector3?

The offset of the point of interaction, in pixels, relative to the center of the Composable this input targets. This is null if an input ray no longer hits the Composable during an Action sequence.

origin: Vector3

The origin of the ray in the receiver's activity space, in pixels.

direction: Vector3

A point indicating the direction the ray is pointing, in the receiver's activity space, in pixels.

Public functions

equals

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

hashCode

open fun hashCode(): Int

toString

open fun toString(): String

Public properties

action

Added in 1.0.0-alpha09
val actionInputEvent.Action

Actions similar to Android's MotionEvent for keeping track of a sequence of events on the same target, e.g., HOVER_ENTER -> HOVER_MOVE -> HOVER_EXIT, DOWN -> MOVE -> UP.

direction

Added in 1.0.0-alpha09
val directionVector3

A point indicating the direction the ray is pointing, in the receiver's activity space, in pixels.

hitPosition

Added in 1.0.0-alpha09
val hitPositionVector3?

The offset of the point of interaction, in pixels, relative to the center of the Composable this input targets. This is null if an input ray no longer hits the Composable during an Action sequence.

origin

Added in 1.0.0-alpha09
val originVector3

The origin of the ray in the receiver's activity space, in pixels.

pointerType

Added in 1.0.0-alpha09
val pointerTypeInputEvent.Pointer

Type of the individual pointer (e.g. left, right or default) for this event.

source

Added in 1.0.0-alpha09
val sourceInputEvent.Source

Type of source (e.g. hands, controller, head) that generated this event.

timestamp

Added in 1.0.0-alpha09
val timestampLong

Timestamp from SystemClock.uptimeMillis time base.