Class ActionEvent
Implements
Constructors
constructor
-
new ActionEvent(
source: any,
pointerX: number,
pointerY: number,
meshUnderPointer: Nullable<AbstractMesh>,
sourceEvent?: any,
additionalData?: any,
): ActionEventCreates a new ActionEvent
Parameters
- source: any
The mesh or sprite that triggered the action
- pointerX: number
The X mouse cursor position at the time of the event
- pointerY: number
The Y mouse cursor position at the time of the event
- meshUnderPointer: Nullable<AbstractMesh>
The mesh that is currently pointed at (can be null)
OptionalsourceEvent: anythe original (browser) event that triggered the ActionEvent
OptionaladditionalData: anyadditional data for the event
Returns ActionEvent
- source: any
Properties
Optionaladditional Data
additional data for the event
mesh Under Pointer
The mesh that is currently pointed at (can be null)
pointer X
The X mouse cursor position at the time of the event
pointer Y
The Y mouse cursor position at the time of the event
source
The mesh or sprite that triggered the action
Optionalsource Event
the original (browser) event that triggered the ActionEvent
Methods
StaticCreate New
-
Helper function to auto-create an ActionEvent from a source mesh.
Parameters
- source: AbstractMesh
The source mesh that triggered the event
Optionalevt: anyThe original (browser) event
OptionaladditionalData: anyadditional data for the event
Returns ActionEvent
the new ActionEvent
- source: AbstractMesh
StaticCreate New From Primitive
-
CreateNewFromPrimitive(
prim: any,
pointerPos: Vector2,
evt?: Event,
additionalData?: any,
): ActionEventHelper function to auto-create an ActionEvent from a primitive
Parameters
- prim: any
defines the target primitive
- pointerPos: Vector2
defines the pointer position
Optionalevt: EventThe original (browser) event
OptionaladditionalData: anyadditional data for the event
Returns ActionEvent
the new ActionEvent
- prim: any
StaticCreate New From Scene
-
Helper function to auto-create an ActionEvent from a scene. If triggered by a mesh use ActionEvent.CreateNew
Parameters
- scene: Scene
the scene where the event occurred
- evt: any
The original (browser) event
Returns ActionEvent
the new ActionEvent
- scene: Scene
StaticCreate New From Sprite
-
Helper function to auto-create an ActionEvent from a source sprite
Parameters
Returns ActionEvent
the new ActionEvent
ActionEvent is the event being sent when an action is triggered.