Files
Foundry-VTT-Docker/resources/app/node_modules/@pixi/events/lib/EventBoundary.mjs.map

1 line
66 KiB
Plaintext
Raw Normal View History

2025-01-04 00:34:03 +01:00
{"version":3,"file":"EventBoundary.mjs","sources":["../src/EventBoundary.ts"],"sourcesContent":["import { Point, utils } from '@pixi/core';\nimport { EventsTicker } from './EventTicker';\nimport { FederatedMouseEvent } from './FederatedMouseEvent';\nimport { FederatedPointerEvent } from './FederatedPointerEvent';\nimport { FederatedWheelEvent } from './FederatedWheelEvent';\n\nimport type { DisplayObject } from '@pixi/display';\nimport type { EmitterListeners, TrackingData } from './EventBoundaryTypes';\nimport type { FederatedEvent } from './FederatedEvent';\nimport type {\n Cursor, EventMode, FederatedEventHandler,\n FederatedEventTarget,\n IFederatedDisplayObject\n} from './FederatedEventTarget';\n\n// The maximum iterations used in propagation. This prevent infinite loops.\nconst PROPAGATION_LIMIT = 2048;\n\nconst tempHitLocation = new Point();\nconst tempLocalMapping = new Point();\n\n/**\n * Event boundaries are \"barriers\" where events coming from an upstream scene are modified before downstream propagation.\n *\n * ## Root event boundary\n *\n * The {@link PIXI.EventSystem#rootBoundary rootBoundary} handles events coming from the <canvas />.\n * {@link PIXI.EventSystem} handles the normalization from native {@link https://dom.spec.whatwg.org/#event Events}\n * into {@link PIXI.FederatedEvent FederatedEvents}. The rootBoundary then does the hit-testing and event dispatch\n * for the upstream normalized event.\n *\n * ## Additional event boundaries\n *\n * An additional event boundary may be desired within an application's scene graph. For example, if a portion of the scene is\n * is flat with many children at one level - a spatial hash maybe needed to accelerate hit testing. In this scenario, the\n * container can be detached from the scene and glued using a custom event boundary.\n *\n * ```ts\n * import { Container } from '@pixi/display';\n * import { EventBoundary } from '@pixi/events';\n * import { SpatialHash } from 'pixi-spatial-hash';\n *\n * class HashedHitTestingEventBoundary\n * {\n * private spatialHash: SpatialHash;\n *\n * constructor(scene: Container, spatialHash: SpatialHash)\n * {\n * super(scene);\n * this.spatialHash = spatialHash;\n * }\n *\n * hitTestRecursive(...)\n * {\n * // TODO: If target === this.rootTarget, then use spatial hash to get a\n * // list of possible children that match the given (x,y) coordinates.\n * }\n * }\n *\n * class VastScene extends DisplayObject\n * {\n * protected eventBoundary: EventBoundary;\n * protected scene: Container;\n * protected spatialHash: SpatialHash;\n *\n * constructor()\n * {\n * this.scene = new Container();\n * this.spatialHash = new SpatialHash();\n * this.eventBoundary = new HashedHitTestingEventBoundary(this.scene, this.spatialHash);\n *\n * // Populate this.scene with a ton of children, while updating this.spatialHash\n * }\n * }\n * ```\n * @memberof PIXI\n */\nexport class EventBoundary\n{\n /**\n * The root event-target residing below the event boundary.\n *\n * All events are dispatched trickling down and bubbling up to this `rootTarget`.\n */\n public rootTarget: DisplayObject;\n\n /**\n * Emits events after they were dispatched into the scene graph.\n *\n * This can be used for global events listening, regardless of the scene graph being used. It should\n * not be used by interactive libraries for normal use.\n *\n * Special events that do not bubble all the way to the root target are not emitted from here,\n * e.g. pointerenter, pointerleave, click.\n */\n public dispatch: utils.EventEmitter = new utils.EventEmitter();\n\n /** The cursor preferred by the event targets underneath this boundary. */\n public cursor: Cursor | string;\n\n /**\n * This flag would emit `pointermove`, `touchmove`, and `mousemove` events on all DisplayObjects.\n *\n * The `moveOnAll` semantics mirror those of earlier versions of PixiJS. This was disable