1 line
6.4 KiB
Plaintext
1 line
6.4 KiB
Plaintext
{"version":3,"file":"init.mjs","sources":["../../src/events/init.ts"],"sourcesContent":["import { extensions } from '../extensions/Extensions';\nimport { Container } from '../scene/container/Container';\nimport { EventSystem } from './EventSystem';\nimport { FederatedContainer } from './FederatedEventTarget';\n\n/* eslint-disable max-len */\n/**\n * PixiJS is primarily a rendering system, but it also includes support for interactivity.\n * Adding support for mouse and touch events to your project is simple and consistent.\n *\n * The new event-based system that replaced InteractionManager from v6 has expanded the definition of what a\n * Container means to be interactive. With this we have introduced `eventMode` which allows you to control\n * how an object responds to interaction events.\n * This is similar to the `interactive` property in v6 but with more options.\n *\n * <details id=\"enabling-interaction\">\n * <summary>Enabling Interaction</summary>\n *\n * Any Container-derived object (Sprite, Container, etc.) can become interactive simply by setting its `eventMode` property to any of\n * the {@link events.EventMode} values. Doing so will cause the object to emit interaction events that can be responded to in order to drive your project's behavior.\n *\n * Check out the [interaction example code](/examples/events/click).\n *\n * Container-derived objects are based on {@link https://www.npmjs.com/package/eventemitter3|EventEmitter3}\n * so you can use `on()`, `once()`, `off()` to listen to events.\n *\n * For example to respond to clicks and taps, bind to an object ike so:\n *\n * ```javascript\n * let sprite = Sprite.from('/some/texture.png');\n *\n * sprite.eventMode = 'static'; // similar to `sprite.interactive = true` in v6\n * sprite.on('pointerdown', (event) => { alert('clicked!'); });\n * ```\n *\n * Check out the **EventTypes** section below for the full list of interaction events supported.\n * </details>\n *\n * <details id=\"event-modes\">\n * <summary>Event Modes</summary>\n *\n * The new event-based system that replaced InteractionManager from v6 has expanded the definition of what a Container\n * means to be interactive. With this we have introduced `eventMode` which allows you to control how an object responds\n * to interaction events. This is similar to the `interactive` property in v6 but with more options.\n *\n * | event mode | Description |\n * |---|---|\n * | `none` | Ignores all interaction events, similar to CSS's `pointer-events: none`, good optimization for non-interactive children |\n * | `passive` | Does not emit events and ignores hit testing on itself but does allow for events and hit testing only its interactive children. If you want to be compatible with v6, set this as your default `eventMode` (see options in Renderer, Application, etc) |\n * | `auto` | Does not emit events and but is hit tested if parent is interactive. Same as `interactive = false` in v7 |\n * | `static` | Emit events and is hit tested. Same as `interaction = true` in v7, useful for objects like buttons that do not move. |\n * | `dynamic` | Emits events and is hit tested but will also receive mock interaction events fired from a ticker to allow for interaction when the mouse isn't moving. This is useful for elements that independently moving or animating. |\n * </details>\n *\n * <details id=\"event-types\">\n * <summary>Event Types</summary>\n *\n * Pixi supports the following event types for interactive objects:\n *\n * | Event Type | Fired When |\n * |---|---|\n * | `pointercancel` | Pointer device button is released outside the display object\n * that initially registered a pointerdown. |\n * | `pointerdown` | Pointer device button is pressed on the display object. |\n * | `pointerenter` | Pointer device enters the display object. |\n * | `pointerleave` | Pointer device leaves the display object. |\n * | `pointermove` | Pointer device is moved while over the display object. |\n * | `globalpointermove` | Pointer device is moved, regardless of hit-testing the current object. |\n * | `pointerout` | Pointer device is moved off the display object. |\n * | `pointerover` | Pointer device is moved onto the display object. |\n * | `pointertap` | Pointer device is tapped twice on the display object. |\n * | `pointerup` | Pointer device button is released over the display object. |\n * | `pointerupoutside` | Pointer device button is released outside the display object\n * that initially registered a pointerdown. |\n * | `mousedown ` | Mouse button is pressed on the display object. |\n * | `mouseenter` | Mouse cursor enters the display object. |\n * | `mouseleave` | Mouse cursor leaves the display object. |\n * | `mousemove ` | Mouse cursor is moved while over the display object. |\n * | `globalmousemove` | Mouse is moved, regardless of hit-testing the current object. |\n * | `mouseout ` | Mouse cursor is moved off the display object. |\n * | `mouseover ` | Mouse cursor is moved onto the display object. |\n * | `mouseup ` | Mouse button is released over the display object. |\n * | `mouseupoutside ` | Mouse button is released outside the display object that initially registered a mousedown. |\n * | `click ` | Mouse button is clicked (pressed and released) over the display object. |\n * | `touchcancel ` | Touch point is removed outside of the display object that initially registered a touchstart. |\n * | `touchend ` | Touch point is removed from the display object. |\n * | `touchendoutside ` | Touch point is removed outside of the display object that initially registered a touchstart. |\n * | `touchmove ` | Touch point is moved along the display object. |\n * | `globaltouchmove` | Touch point is moved, regardless of hit-testing the current object. |\n * | `touchstart ` | Touch point is placed on the display object. |\n * | `tap ` | Touch point is tapped twice on the display object. |\n * | `wheel ` | Mouse wheel is spun over the display object. |\n * | `rightclick ` | Right mouse button is clicked (pressed and released) over the display object. |\n * | `rightdown ` | Right mouse button is pressed on the display object. |\n * | `rightup ` | Right mouse button is released over the display object. |\n * | `rightupoutside ` | Right mouse button is released outside the display object that initially registered a rightdown. |\n * </details>\n * @namespace events\n */\n/* eslint-enable max-len */\n\nextensions.add(EventSystem);\nContainer.mixin(FederatedContainer);\n"],"names":[],"mappings":";;;;;;AAqGA,UAAA,CAAW,IAAI,WAAW,CAAA,CAAA;AAC1B,SAAA,CAAU,MAAM,kBAAkB,CAAA"} |