Skip to main content

Interface: UiInteractableEcsComponent

Defined in: ui/components/ui-interactable-component.ts:51

A rect that participates in pointer/gamepad interaction. Attach alongside a RectTransformEcsComponent to make any rect - not just a button - clickable, hoverable, and focus-navigable: a toggle, a slider handle, a list row, a close icon.

Invocation is source-agnostic: onInvoke is raised both by a pointer release on this element (via createUiInteractionEcsSystem) and by submitInput while this element is focused (via createUiNavigationEcsSystem), and the listener cannot tell which fired it - so game code reacts to "this element was invoked" without caring whether a mouse, a gamepad, or a script did it.

Extends​

Properties​

blocksRaycasts​

blocksRaycasts: boolean

Defined in: ui/components/ui-interactable-component.ts:28

Whether this element is considered by createUiRaycastEcsSystem at all. false makes the element fully transparent to raycasting - the pointer passes through to whatever is behind it - regardless of interactable. Set false on a purely decorative interactable (rare) or a temporarily inert one.

Inherited from​

UiInteractableDefaultedOptions.blocksRaycasts


dragThreshold​

dragThreshold: number

Defined in: ui/components/ui-interactable-component.ts:35

How far, in reference pixels (UI world units), the pointer must move from its press-down position before a held press becomes a drag (see createUiInteractionEcsSystem's pointer state machine).

Inherited from​

UiInteractableDefaultedOptions.dragThreshold


interactable​

interactable: boolean

Defined in: ui/components/ui-interactable-component.ts:19

Whether this element participates in interaction at all - receives hover/press/focus and raises onInvoke. A false interactable is skipped by createUiNavigationEcsSystem's focus traversal, and (unlike blocksRaycasts) still blocks the raycast for elements behind it if blocksRaycasts is true, the same way a disabled button still shadows whatever is under it.

Inherited from​

UiInteractableDefaultedOptions.interactable


isDragging​

isDragging: boolean

Defined in: ui/components/ui-interactable-component.ts:113

Whether a captured press on this element has exceeded dragThreshold. System-owned, written by createUiInteractionEcsSystem; read-only to callers.


isFocused​

isFocused: boolean

Defined in: ui/components/ui-interactable-component.ts:97

Whether this is the canvas's currently focused element - the source-agnostic "currently selected" state driven by directional navigation and, by canvas policy, by the pointer hovering this element. System-owned, written by createUiNavigationEcsSystem and createUiInteractionEcsSystem; read-only to callers.


isHovered​

isHovered: boolean

Defined in: ui/components/ui-interactable-component.ts:88

Whether the pointer is currently over this element. Pointer-only - always false when navigating by gamepad/keyboard. System-owned, written by createUiInteractionEcsSystem; read-only to callers.


isPressed​

isPressed: boolean

Defined in: ui/components/ui-interactable-component.ts:106

Whether this element currently holds a captured press and the pointer is still over it - moving the pointer off a held-down element visually un-presses it without cancelling the gesture; pressCapture tracks the gesture itself. System-owned, written by createUiInteractionEcsSystem; read-only to callers.


onBeginDrag​

readonly onBeginDrag: ForgeEvent

Defined in: ui/components/ui-interactable-component.ts:75

Raised when a captured press first exceeds dragThreshold. Pointer-only

  • a drag has no gamepad/keyboard analogue.

onDrag​

readonly onDrag: ForgeEvent

Defined in: ui/components/ui-interactable-component.ts:78

Raised every tick the pointer moves while isDragging. Pointer-only.


onEndDrag​

readonly onEndDrag: ForgeEvent

Defined in: ui/components/ui-interactable-component.ts:81

Raised on the pointer-up edge that ends a drag. Pointer-only.


onInvoke​

readonly onInvoke: ForgeEvent

Defined in: ui/components/ui-interactable-component.ts:53

Raised when this element is invoked, by a pointer click or a submit action.


onPointerDown​

readonly onPointerDown: ForgeEvent

Defined in: ui/components/ui-interactable-component.ts:62

Raised on a pointer-down edge landing on this element. Pointer-only.


onPointerEnter​

readonly onPointerEnter: ForgeEvent

Defined in: ui/components/ui-interactable-component.ts:56

Raised when the pointer starts being over this element. Pointer-only.


onPointerExit​

readonly onPointerExit: ForgeEvent

Defined in: ui/components/ui-interactable-component.ts:59

Raised when the pointer stops being over this element. Pointer-only.


onPointerUp​

readonly onPointerUp: ForgeEvent

Defined in: ui/components/ui-interactable-component.ts:69

Raised on a pointer-up edge, when this element captured the matching press (see isPressed) - whether or not the pointer is still over it. Pointer-only.


pressCapture​

pressCapture: { originPosition: Vector2; } | null

Defined in: ui/components/ui-interactable-component.ts:136

System-owned bookkeeping createUiInteractionEcsSystem uses to track an in-progress press/drag gesture across ticks between a pointer down and its matching up - non-null from the down edge until the matching up edge, regardless of whether the pointer stays over the element in between (so isPressed/drag-threshold/onInvoke all resolve correctly even if the pointer wanders off and back). originPosition is the pointer's position, in its canvas's UI world space, at the tick the press began - what dragThreshold is measured against. Not part of the public state surface - read isPressed/isDragging/wasInvokedThisFrame instead of this directly.


wasInvokedThisFrame​

wasInvokedThisFrame: boolean

Defined in: ui/components/ui-interactable-component.ts:122

true for exactly one tick: the tick onInvoke was raised, from either the pointer or the focus path. Poll this instead of registering an onInvoke listener when that idiom fits better. System-owned, written by createUiInteractionEcsSystem and createUiNavigationEcsSystem; read-only to callers.