MovableComponent


class MovableComponent : Component


Allows users to interactively move the Entity. This component can be attached to a single instance of any PanelEntity.

NOTE: This Component is currently unsupported on GltfModelEntity.

Summary

Public functions

Unit
addMoveListener(executor: Executor, moveListener: MoveListener)

Adds a listener to the set of active listeners for the move events.

open Boolean
onAttach(entity: Entity)

Called when this component is attached to the entity.

open Unit
onDetach(entity: Entity)

Called when this component is detached from the entity.

Unit

Removes a listener from the set of active listeners for the move events.

Public properties

Dimensions

The current size of the entity, in meters.

Public functions

addMoveListener

Added in 1.0.0-alpha01
fun addMoveListener(executor: Executor, moveListener: MoveListener): Unit

Adds a listener to the set of active listeners for the move events. The listener will be invoked regardless of whether the entity is being moved by the system or the user.

The listener is invoked on the provided executor. If the app intends to modify the UI elements/views during the callback, the app should provide the thread executor that is appropriate for the UI operations. For example, if the app is using the main thread to render the UI, the app should provide the main thread (Looper.getMainLooper()) executor. If the app is using a separate thread to render the UI, the app should provide the executor for that thread.

Parameters
executor: Executor

The executor to run the listener on.

moveListener: MoveListener

The move event listener to set.

onAttach

Added in 1.0.0-alpha01
open fun onAttach(entity: Entity): Boolean

Called when this component is attached to the entity.

Parameters
entity: Entity

Entity this component is being attached to.

Returns
Boolean

True if the component can attach to given Entity.

onDetach

Added in 1.0.0-alpha01
open fun onDetach(entity: Entity): Unit

Called when this component is detached from the entity.

Parameters
entity: Entity

Entity this component is being detached from.

removeMoveListener

Added in 1.0.0-alpha01
fun removeMoveListener(moveListener: MoveListener): Unit

Removes a listener from the set of active listeners for the move events.

Parameters
moveListener: MoveListener

The move event listener to remove.

Public properties

size

Added in 1.0.0-alpha01
var sizeDimensions

The current size of the entity, in meters. The size of the entity determines the size of the bounding box that is used to draw the draggable move affordances around the entity.