OptionalrootTarget: DisplayObjectThe 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
ProtectedeventThe event pool maps event constructors to an free pool of instances of those specific events.
ProtectedmappingState object for mapping methods.
ProtectedmappingMaps event types to forwarding handles for them.
PIXI.EventBoundary EventBoundary provides mapping for "pointerdown", "pointermove", "pointerout", "pointerleave", "pointerover", "pointerup", and "pointerupoutside" by default.
This flag would emit pointermove, touchmove, and mousemove events on all DisplayObjects.
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 PIXI.EventSystem) and dispatch new downstream events generally trickling down and bubbling up to PIXI.EventBoundary.rootTarget 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 {@code e} to all interactive display objects. The event is propagated in the bubbling phase always.
This is used in the globalpointermove event.
The emitted event.
Optionaltype: string | string[]The listeners to notify.
Optionaltargets: FederatedEventTarget[]The targets to notify.
ProtectedallocateAllocate a specific type of event from PIXI.EventBoundary#eventPool this.eventPool.
This allocation is constructor-agnostic, as long as it only takes one argument - this event boundary.
The event's constructor.
ProtectedcloneClones the event {@code from}, with an optional {@code type} override.
The event is allocated using PIXI.EventBoundary#allocateEvent this.allocateEvent.
The event to clone.
Optionaltype: stringThe type of the returned event.
ProtectedcopyCopies base PIXI.FederatedEvent data from {@code from} into {@code to}.
The following properties are copied:
The event to copy data from.
The event to copy data into.
ProtectedcopyCopies mouse PIXI.FederatedMouseEvent data from {@code from} to {@code to}.
The following properties are copied:
ProtectedcopyCopies pointer PIXI.FederatedPointerEvent data from {@code from} into {@code to}.
The following properties are copied:
ProtectedcopyCopies wheel PIXI.FederatedWheelEvent data from {@code from} into {@code to}.
The following properties are copied:
ProtectedcreateCreates an event whose {@code originalEvent} is {@code from}, with an optional type and target override.
The event is allocated using PIXI.EventBoundary#allocateEvent this.allocateEvent.
The {@code originalEvent} for the returned event.
Optionaltype: stringThe type of the returned event.
Optionaltarget: FederatedEventTargetThe target of the returned event.
ProtectedcreateCreates a wheel event whose {@code originalEvent} is {@code from}.
The event is allocated using PIXI.EventBoundary#allocateEvent this.allocateEvent.
The upstream wheel event.
ProtectedfindFinds the most specific event-target in the given propagation path that is still mounted in the scene graph.
This is used to find the correct pointerup and pointerout target in the case that the original pointerdown
or pointerover target was unmounted from the scene graph.
The propagation path was valid in the past.
ProtectedfreeFrees the event and puts it back into the event pool.
It is illegal to reuse the event until it is allocated again, using this.allocateEvent.
It is also advised that events not allocated from PIXI.EventBoundary#allocateEvent this.allocateEvent not be freed. This is because of the possibility that the same event is freed twice, which can cause it to be allocated twice & result in overwriting.
The event to be freed.
ProtectedhitChecks whether the display object or any of its children cannot pass the hit test at all.
PIXI.EventBoundary's implementation uses the PIXI.DisplayObject.hitArea hitArea and PIXI.DisplayObject._mask for pruning.
Finds the DisplayObject 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.
ProtectedhitChecks whether the display object passes hit testing for the given location.
displayObject passes hit testing for location.ProtectedhitOptionalpruneFn: (object: DisplayObject, pt: Point) => booleanOptionalignore: booleanProtectedhitRecursive implementation for PIXI.EventBoundary.hitTest hitTest.
The DisplayObject that is to be hit tested.
The event mode for the currentTarget or one of its parents.
The location that is being tested for overlap.
Callback that determines whether the target passes hit testing. This callback
can assume that pruneFn failed to prune the display object.
OptionalpruneFn: (object: DisplayObject, pt: Point) => booleanCallback that determiness whether the target and all of its children cannot pass the hit test. It is used as a preliminary optimization to prune entire subtrees of the scene graph.
An array holding the hit testing target and all its ancestors in order. The first element is the target itself and the last is PIXI.EventBoundary.rootTarget rootTarget. This is the opposite order w.r.t. the propagation path. If no hit testing target is found, null is returned.
Maps the given upstream event through the event boundary and propagates it downstream.
ProtectedmapMaps the upstream pointerdown events to a downstream pointerdown event.
touchstart, rightdown, mousedown events are also dispatched for specific pointer types.
ProtectedmapMaps the upstream pointermove to downstream pointerout, pointerover, and pointermove events, in that order.
The tracking data for the specific pointer has an updated overTarget. mouseout, mouseover,
mousemove, and touchmove events are fired as well for specific pointer types.
The upstream pointermove event.
ProtectedmapMaps the upstream pointerout to downstream pointerout, pointerleave events, in that order.
The tracking data for the specific pointer is cleared of a overTarget.
The upstream pointerout event.
ProtectedmapMaps the upstream pointerover to downstream pointerover and pointerenter events, in that order.
The tracking data for the specific pointer gets a new overTarget.
The upstream pointerover event.
ProtectedmapMaps the upstream pointerup event to downstream pointerup, pointerupoutside,
and click/rightclick/pointertap events, in that order.
The pointerupoutside event bubbles from the original pointerdown target to the most specific
ancestor of the pointerdown and pointerup targets, which is also the click event's target. touchend,
rightup, mouseup, touchendoutside, rightupoutside, mouseupoutside, and tap are fired as well for
specific pointer types.
The upstream pointerup event.
ProtectedmapMaps the upstream pointerupoutside event to a downstream pointerupoutside event, bubbling from the original
pointerdown target to rootTarget.
(The most specific ancestor of the pointerdown event and the pointerup event must the
{@link PIXI.EventBoundary}'s root because the pointerup` event occurred outside of the boundary.)
touchendoutside, mouseupoutside, and rightupoutside events are fired as well for specific pointer
types. The tracking data for the specific pointer is cleared of a pressTarget.
The upstream pointerupoutside event.
ProtectedmapMaps the upstream wheel event to a downstream wheel event.
The upstream wheel event.
ProtectednotifyNotify all the listeners to the event's currentTarget.
If the currentTarget contains the property on<type>, then it is called here,
simulating the behavior from version 6.x and prior.
The event passed to the target.
Optionaltype: stringPropagate the passed event from from PIXI.EventBoundary.rootTarget this.rootTarget to its target {@code e.target}.
The event to propagate.
Optionaltype: stringFinds the propagation path from PIXI.EventBoundary.rootTarget rootTarget to the passed {@code target}. The last element in the path is {@code target}.
ProtectedtrackingThe pointer ID.
The tracking data stored for the given pointer. If no data exists, a blank state will be created.
Event boundaries are "barriers" where events coming from an upstream scene are modified before downstream propagation.
Root event boundary
The PIXI.EventSystem#rootBoundary rootBoundary handles events coming from the <canvas />. PIXI.EventSystem handles the normalization from native Events into PIXI.FederatedEvent 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.
Memberof
PIXI