ResizableComponent


class ResizableComponent : Component


A Component which when attached to a PanelEntity provides a user-resize affordance.

Note: This Component is currently unsupported on GltfModelEntity.

Summary

Public functions

Unit
addResizeListener(executor: Executor, resizeListener: ResizeListener)

Adds the listener to the set of listeners that are invoked through the resize operation, such as start, ongoing and end.

open Boolean
onAttach(entity: Entity)

Attaches this component to the given entity.

open Unit
onDetach(entity: Entity)

Detaches this component from the entity it is attached to.

Unit

Removes a listener from the set listening to resize events.

Public properties

Float

The aspect ratio of the entity during resizing.

Dimensions

An upper bound for the User's resize actions, in meters.

Dimensions

A lower bound for the User's resize actions, in meters.

Dimensions

The current size of the entity, in meters.

Public functions

addResizeListener

Added in 1.0.0-alpha01
fun addResizeListener(executor: Executor, resizeListener: ResizeListener): Unit

Adds the listener to the set of listeners that are invoked through the resize operation, such as start, ongoing and end.

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 use for the listener callback.

resizeListener: ResizeListener

The listener to be invoked when a resize event occurs.

onAttach

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

Attaches this component to the given entity.

Parameters
entity: Entity

The entity to attach this component to.

Returns
Boolean

true if the component was successfully attached, false otherwise.

onDetach

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

Detaches this component from the entity it is attached to.

Parameters
entity: Entity

The entity to detach this component from.

removeResizeListener

Added in 1.0.0-alpha01
fun removeResizeListener(resizeListener: ResizeListener): Unit

Removes a listener from the set listening to resize events.

Parameters
resizeListener: ResizeListener

The listener to be removed.

Public properties

fixedAspectRatio

Added in 1.0.0-alpha01
var fixedAspectRatioFloat

The aspect ratio of the entity during resizing. The aspect ratio is determined by taking the entity's width over its height. A value of 0.0f (or negative) means there are no preferences.

This method does not immediately resize the entity. The new aspect ratio will be applied the next time the user resizes the entity through the reform UI. During this resize operation, the entity's current area will be preserved.

If a different resizing behavior is desired, such as fixing the width and adjusting the height, the client can manually resize the entity to the preferred dimensions before calling this method. No automatic resizing will occur when using the reform UI then.

maximumSize

Added in 1.0.0-alpha01
var maximumSizeDimensions

An upper bound for the User's resize actions, in meters. This value constrains large the user can resize the bounding box of the entity. The size of the content inside that bounding box is fully controlled by the application.

minimumSize

Added in 1.0.0-alpha01
var minimumSizeDimensions

A lower bound for the User's resize actions, in meters. This value constrains how small the user can resize the bounding box of the entity. The size of the content inside that bounding box is fully controlled by the application.

size

Added in 1.0.0-alpha01
var sizeDimensions

The current size of the entity, in meters. This property is automatically updated after resize events to match the resize affordance to the newly suggested size of the content. The apps can still override it. The default value is set to 1 meter, updated to the size of the entity when attached.