1 line
41 KiB
Plaintext
1 line
41 KiB
Plaintext
|
|
{"version":3,"file":"EventSystem.mjs","sources":["../src/EventSystem.ts"],"sourcesContent":["import { extensions, ExtensionType } from '@pixi/core';\nimport { EventBoundary } from './EventBoundary';\nimport { EventsTicker } from './EventTicker';\nimport { FederatedPointerEvent } from './FederatedPointerEvent';\nimport { FederatedWheelEvent } from './FederatedWheelEvent';\n\nimport type { ExtensionMetadata, IPointData, IRenderer, ISystem } from '@pixi/core';\nimport type { DisplayObject } from '@pixi/display';\nimport type { PixiTouch } from './FederatedEvent';\nimport type { EventMode } from './FederatedEventTarget';\nimport type { FederatedMouseEvent } from './FederatedMouseEvent';\n\nconst MOUSE_POINTER_ID = 1;\nconst TOUCH_TO_POINTER: Record<string, string> = {\n touchstart: 'pointerdown',\n touchend: 'pointerup',\n touchendoutside: 'pointerupoutside',\n touchmove: 'pointermove',\n touchcancel: 'pointercancel',\n};\n\n/** @ignore */\nexport interface EventSystemOptions\n{\n /**\n * The default event mode mode for all display objects.\n * This option only is available when using **@pixi/events** package\n * (included in the **pixi.js** and **pixi.js-legacy** bundle), otherwise it will be ignored.\n * @memberof PIXI.IRendererOptions\n */\n eventMode?: EventMode;\n\n /**\n * The event features that are enabled by the EventSystem\n * This option only is available when using **@pixi/events** package\n * (included in the **pixi.js** and **pixi.js-legacy** bundle), otherwise it will be ignored.\n * @memberof PIXI.IRendererOptions\n * @example\n * const app = new PIXI.Application({\n * view: canvas,\n * events: {\n * move: true,\n * globalMove: false,\n * click: true,\n * wheel: true,\n * },\n * });\n */\n eventFeatures?: Partial<EventSystemFeatures>\n}\n\n/**\n * The event features that are enabled by the EventSystem\n * This option only is available when using **@pixi/events** package\n * (included in the **pixi.js** and **pixi.js-legacy** bundle), otherwise it will be ignored.\n * @memberof PIXI\n * @since 7.2.0\n */\ninterface EventSystemFeatures\n{\n /**\n * Enables pointer events associated with pointer movement:\n * - `pointermove` / `mousemove` / `touchmove`\n * - `pointerout` / `mouseout`\n * - `pointerover` / `mouseover`\n */\n move: boolean;\n // eslint-disable-next-line jsdoc/multiline-blocks\n /**\n * Enables global pointer move events:\n * - `globalpointermove`\n * - `globalmousemove`\n * - `globaltouchemove`\n */\n globalMove: boolean;\n /**\n * Enables pointer events associated with clicking:\n * - `pointerup` / `mouseup` / `touchend` / 'rightup'\n * - `pointerupoutside` / `mouseupoutside` / `touchendoutside` / 'rightupoutside'\n * - `pointerdown` / 'mousedown' / `touchstart` / 'rightdown'\n * - `click` / `tap`\n */\n click: boolean;\n /** - Enables wheel events. */\n wheel: boolean;\n}\n\n/**\n * The system for handling UI events.\n * @memberof PIXI\n */\nexport class EventSystem implements ISystem<EventSystemOptions>\n{\n /** @ignore */\n static extension: ExtensionMetadata = {\n name: 'events',\n type: [\n ExtensionType.RendererSystem,\n ExtensionType.CanvasRendererSystem\n ],\n };\n\n /**\n * The event features that are enabled by the EventSystem\n * This option only is available when using **@pixi/events** package\n * (included in the **pixi.js** and **pixi.js-legacy** bundle), otherwise it will be ignored.\n * @since 7.2.0\n */\n public static defaultEventFeatures: EventSystemFeatures = {\n move: true,\n globalMove: true,\n click: true,\n wheel: true,\n };\n\n private static _defaultEventMode: EventMode;\n\n /**\n * The default interaction mode for all display objects.\n * @see PIXI.DisplayObject.eventMode\n * @type {PIXI.EventMode}\n * @readonly\n * @sin
|