Skip to main content

Events

APIs for pointer interactions and action triggers.


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

AttributeTypeDescription
positionVectorLocal coordinates
idnumberPointer 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

Fires actions in the runtime.

Note: The official scripting docs do not list methods on Trigger directly. In practice, triggers are usually accessed via viewModel:getTrigger(...), which returns a PropertyTrigger with fire() and listener methods.

See Also: PropertyTrigger

Next Steps