PointerCaptureComponent


public final class PointerCaptureComponent implements Component


Provides pointer capture capabilities for a given entity.

To enable pointer capture, the task must be in full space, and the entity must be visible.

Only one PointerCaptureComponent can be attached to an entity at a given time. If a second one tries to attach to an entity, it will fail.

Summary

Nested types

Listener for pointer capture state changes.

Constants

static final int

Pointer Capture is disabled for this component.

static final int

Pointer Capture is enabled for this component.

static final int

Pointer Capture has been stopped for this component.

Public methods

static final @NonNull PointerCaptureComponent
create(
    @NonNull Session session,
    @NonNull Executor executor,
    @NonNull PointerCaptureComponent.StateListener stateListener,
    @NonNull InputEventListener inputListener
)

Factory function for creating PointerCaptureComponent instances.

boolean

Called when this component is attached to the entity.

void

Called when this component is detached from the entity.

Constants

POINTER_CAPTURE_STATE_ACTIVE

public static final int POINTER_CAPTURE_STATE_ACTIVE = 1

Pointer Capture is disabled for this component.

POINTER_CAPTURE_STATE_PAUSED

public static final int POINTER_CAPTURE_STATE_PAUSED = 0

Pointer Capture is enabled for this component.

POINTER_CAPTURE_STATE_STOPPED

public static final int POINTER_CAPTURE_STATE_STOPPED = 2

Pointer Capture has been stopped for this component.

Public methods

create

Added in 1.0.0-alpha01
public static final @NonNull PointerCaptureComponent create(
    @NonNull Session session,
    @NonNull Executor executor,
    @NonNull PointerCaptureComponent.StateListener stateListener,
    @NonNull InputEventListener inputListener
)

Factory function for creating PointerCaptureComponent instances.

onAttach

Added in 1.0.0-alpha01
public boolean onAttach(@NonNull Entity entity)

Called when this component is attached to the entity.

Parameters
@NonNull 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
public void onDetach(@NonNull Entity entity)

Called when this component is detached from the entity.

Parameters
@NonNull Entity entity

Entity this component is being detached from.