InteractionPolicy

interface InteractionPolicy


Defines the interaction policy for a spatial object. This policy enables reacting to a user's spatial inputs.

Summary

Public companion functions

InteractionPolicy
clickable(isEnabled: Boolean, onClick: () -> Unit)

An InteractionPolicy that detects only click inputs

Public functions

Unit

Raw event executed with every input update.

Public properties

Boolean

Whether an interaction policy is enabled for this object.

Public companion functions

clickable

Added in 1.0.0-alpha14
fun clickable(isEnabled: Boolean = true, onClick: () -> Unit): InteractionPolicy

An InteractionPolicy that detects only click inputs

Parameters
isEnabled: Boolean = true

Whether an interaction policy is enabled for this object. If false, click events will not be returned.

onClick: () -> Unit

Executed after a click occurs.

Returns
InteractionPolicy

an InteractionPolicy that filters for click events.

Public functions

onInputEvent

Added in 1.0.0-alpha14
fun onInputEvent(event: SpatialInputEvent): Unit

Raw event executed with every input update.

Public properties

isEnabled

Added in 1.0.0-alpha14
val isEnabledBoolean

Whether an interaction policy is enabled for this object. If false, spatial interaction input events will not be returned.