ResizableComponent
class ResizableComponent : Component
This Component can be attached to a single instance of an Entity. When attached, this Component will enable the user to resize the Entity by selecting and dragging along the boundaries of a user-resize affordance. While resizing an overlay will appear indicating the proposed updated size.
This component cannot be attached to an AnchorSpace or to the ActivitySpace. Calling Entity.addComponent to an Entity with these types will return false.
Note: This Component is currently unsupported on GltfModelEntity.
Summary
Public companion functions |
|
|---|---|
ResizableComponent |
create(Public factory function for creating a ResizableComponent. |
Public functions |
|
|---|---|
Unit |
addResizeEventListener(Adds the listener to the set of listeners that are invoked through the resize operation, such as start, ongoing and end. |
Unit |
removeResizeEventListener(resizeEventListener: Consumer<ResizeEvent>)Removes a listener from the set listening to resize events. |
Protected functions |
|
|---|---|
open Boolean |
Called by the framework when this component is being added to an |
open Unit |
Called by the framework when this component is being removed from an |
Public properties |
|
|---|---|
FloatSize3d |
The current size of the affordance for the |
Boolean |
Whether a resize overlay will be shown even if the entity is not being resized. |
Boolean |
Whether the content of the |
Boolean |
Whether the aspect ratio is maintained during resizing. |
FloatSize3d |
An upper bound for the User's resize actions, in meters. |
FloatSize3d |
A lower bound for the User's resize actions, in meters. |
Public companion functions
create
fun create(
session: Session,
minimumSize: FloatSize3d = kMinimumSize,
maximumSize: FloatSize3d = kMaximumSize,
executor: Executor = HandlerExecutor.mainThreadExecutor,
resizeEventListener: Consumer<ResizeEvent>
): ResizableComponent
Public factory function for creating a ResizableComponent.
This Component can be attached to a single instance of an Entity. When attached, this Component will enable the user to resize the Entity by dragging along the boundaries of a user-resize affordance.
This component cannot be attached to an AnchorSpace or to the ActivitySpace. Calling Entity.addComponent to an Entity with these types will return false.
| Parameters | |
|---|---|
session: Session |
The |
minimumSize: FloatSize3d = kMinimumSize |
A lower bound for the User's resize actions, in meters. This value is used to set constraints on how small the user can resize the bounding box of the entity down to. The size of the content inside that bounding box is fully controlled by the application. The default value is 0 meters. |
maximumSize: FloatSize3d = kMaximumSize |
An upper bound for the User's resize actions, in meters. This value is used to set constraints on how large the user can resize the bounding box of the entity up to. The size of the content inside that bounding box is fully controlled by the application. The default value is 10 meters. |
executor: Executor = HandlerExecutor.mainThreadExecutor |
The Executor to run the listener on. By default, listener is invoked on the main thread. |
resizeEventListener: Consumer<ResizeEvent> |
A resize event listener for the event. The application should set the size of a PanelEntity using |
| Returns | |
|---|---|
ResizableComponent |
|
Public functions
addResizeEventListener
fun addResizeEventListener(
executor: Executor = HandlerExecutor.mainThreadExecutor,
resizeEventListener: Consumer<ResizeEvent>
): 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 provided.
| Parameters | |
|---|---|
executor: Executor = HandlerExecutor.mainThreadExecutor |
The Executor to run the listener on. By default, listener is invoked on the main thread. |
resizeEventListener: Consumer<ResizeEvent> |
The listener to be invoked when a resize event occurs. |
removeResizeEventListener
fun removeResizeEventListener(resizeEventListener: Consumer<ResizeEvent>): Unit
Removes a listener from the set listening to resize events.
| Parameters | |
|---|---|
resizeEventListener: Consumer<ResizeEvent> |
The listener to be removed. |
Protected functions
onAttach
protected open fun onAttach(entity: Entity): Boolean
Called by the framework when this component is being added to an Entity.
This method is triggered when Entity.addComponent is invoked. Implementations should override this method to perform setup logic or to validate if the component is compatible with the provided entity.
onDetach
protected open fun onDetach(entity: Entity): Unit
Called by the framework when this component is being removed from an Entity.
This method is triggered when Entity.removeComponent is invoked. Implementations should override this method to release resources or undo any changes made during onAttach.
Public properties
affordanceSize
var affordanceSize: FloatSize3d
The current size of the affordance for 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. If attached to a PanelEntity, this is updated to the size of the Entity when attached.
isAlwaysShowOverlayEnabled
var isAlwaysShowOverlayEnabled: Boolean
Whether a resize overlay will be shown even if the entity is not being resized.
This is useful for resizing multiple panels at once.
isAutoHideContentWhileResizingEnabled
var isAutoHideContentWhileResizingEnabled: Boolean
Whether the content of the Entity, and all child Entities, will be automatically hidden while it is being resized.
isFixedAspectRatioEnabled
var isFixedAspectRatioEnabled: Boolean
Whether the aspect ratio is maintained during resizing.
If true the affordance will maintain its current aspect ratio being resized and all suggested sizes will maintain the current aspect ratio. This defaults to false.
maximumEntitySize
var maximumEntitySize: FloatSize3d
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.
minimumEntitySize
var minimumEntitySize: FloatSize3d
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.