Events
APIs for pointer interactions.
PointerEvent
Pointer interaction event data.
Constructor
PointerEvent.new(id, position)
Creates a new PointerEvent. Used for forwarding events to nested artboards.
PointerEvent.new(id: number, position: Vector): PointerEvent
Example:
-- Forward event to nested artboard
local childPos = transformToChildSpace(event.position)
local childEvent = PointerEvent.new(event.id, childPos)
Attributes
| Attribute | Type | Description |
|---|---|---|
position | Vector | Local coordinates |
id | number | Pointer ID (for multitouch) |
Methods
event:hit(isTranslucent?)
Marks the event as handled. If isTranslucent is true, the event may continue to propagate through translucent hit targets.
event:hit() -- Standard: stops propagation
event:hit(true) -- Translucent: may continue through
Example:
function pointerDown(self, event: PointerEvent)
if isInBounds(event.position) then
self.pressed = true
event:hit()
end
end
Trigger
See Data & Input: Trigger for the Trigger type reference, and Trigger Inputs for the full usage guide.
Next Steps
- Continue to Assets
- Need a refresher? Review Quick Reference