Advanced
Optional
rootTarget: ContainerThe holder of the event boundary.
The cursor preferred by the event targets underneath this boundary.
Emits events after they were dispatched into the scene graph.
This can be used for global events listening, regardless of the scene graph being used. It should not be used by interactive libraries for normal use.
Special events that do not bubble all the way to the root target are not emitted from here, e.g. pointerenter, pointerleave, click.
Enables the global move events. globalpointermove
, globaltouchmove
, and globalmousemove
This flag would emit pointermove
, touchmove
, and mousemove
events on all Containers.
The moveOnAll
semantics mirror those of earlier versions of PixiJS. This was disabled in favor of
the Pointer Event API's approach.
The root event-target residing below the event boundary.
All events are dispatched trickling down and bubbling up to this rootTarget
.
Adds an event mapping for the event type
handled by fn
.
Event mappings can be used to implement additional or custom events. They take an event coming from the upstream scene (or directly from the EventSystem) and dispatch new downstream events generally trickling down and bubbling up to this.rootTarget.
To modify the semantics of existing events, the built-in mapping methods of EventBoundary should be overridden instead.
The type of upstream event to map.
The mapping method. The context of this function must be bound manually, if desired.
Emits the event e
to all interactive containers. The event is propagated in the bubbling phase always.
This is used in the globalpointermove
event.
The emitted event.
Optional
type: string | string[]The listeners to notify.
The targets to notify.
Dispatches the given event
The event to dispatch.
Optional
type: stringThe type of event to dispatch. Defaults to e.type
.
Finds the Container that is the target of a event at the given coordinates.
The passed (x,y) coordinates are in the world space above this event boundary.
The x coordinate of the event.
The y coordinate of the event.
Maps the given upstream event through the event boundary and propagates it downstream.
The event to map.
Propagate the passed event from from this.rootTarget to its
target e.target
.
The event to propagate.
Optional
type: stringThe type of event to propagate. Defaults to e.type
.
Finds the propagation path from rootTarget to the passed
target
. The last element in the path is target
.
The target to find the propagation path to.
Event boundaries are "barriers" where events coming from an upstream scene are modified before downstream propagation.
Root event boundary
The rootBoundary handles events coming from the <canvas />. EventSystem handles the normalization from native Events into FederatedEvents. The rootBoundary then does the hit-testing and event dispatch for the upstream normalized event.
Additional event boundaries
An additional event boundary may be desired within an application's scene graph. For example, if a portion of the scene is is flat with many children at one level - a spatial hash maybe needed to accelerate hit testing. In this scenario, the container can be detached from the scene and glued using a custom event boundary.