UNPKG

pixi.js

Version:

<p align="center"> <a href="https://pixijs.com" target="_blank" rel="noopener noreferrer"> <img height="150" src="https://files.pixijs.download/branding/pixijs-logo-transparent-dark.svg?v=1" alt="PixiJS logo"> </a> </p> <br/> <p align="center">

1 lines 3.63 kB
{"version":3,"file":"FederatedWheelEvent.mjs","sources":["../../src/events/FederatedWheelEvent.ts"],"sourcesContent":["import { FederatedMouseEvent } from './FederatedMouseEvent';\n\n/**\n * A specialized event class for wheel/scroll interactions in PixiJS applications.\n * Extends {@link FederatedMouseEvent} to provide wheel-specific properties while\n * maintaining compatibility with the DOM WheelEvent interface.\n *\n * Key features:\n * - Provides scroll delta information\n * - Supports different scroll modes (pixel, line, page)\n * - Inherits mouse event properties\n * - Normalizes cross-browser wheel events\n * @example\n * ```ts\n * // Basic wheel event handling\n * sprite.on('wheel', (event: FederatedWheelEvent) => {\n * // Get scroll amount\n * console.log('Vertical scroll:', event.deltaY);\n * console.log('Horizontal scroll:', event.deltaX);\n *\n * // Check scroll mode\n * if (event.deltaMode === FederatedWheelEvent.DOM_DELTA_LINE) {\n * console.log('Scrolling by lines');\n * } else if (event.deltaMode === FederatedWheelEvent.DOM_DELTA_PAGE) {\n * console.log('Scrolling by pages');\n * } else {\n * console.log('Scrolling by pixels');\n * }\n *\n * // Get scroll position\n * console.log('Scroll at:', event.global.x, event.global.y);\n * });\n *\n * // Common use case: Zoom control\n * container.on('wheel', (event: FederatedWheelEvent) => {\n * // Prevent page scrolling\n * event.preventDefault();\n *\n * // Zoom in/out based on scroll direction\n * const zoomFactor = 1 + (event.deltaY / 1000);\n * container.scale.set(container.scale.x * zoomFactor);\n * });\n * ```\n * @see {@link FederatedMouseEvent} For base mouse event functionality\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/WheelEvent} DOM WheelEvent Interface\n * @see {@link EventSystem} For the event management system\n * @category events\n * @standard\n */\nexport class FederatedWheelEvent extends FederatedMouseEvent implements WheelEvent\n{\n /**\n * The units of `deltaX`, `deltaY`, and `deltaZ`. This is one of `DOM_DELTA_LINE`,\n * `DOM_DELTA_PAGE`, `DOM_DELTA_PIXEL`.\n */\n public deltaMode: number;\n\n /** Horizontal scroll amount */\n public deltaX: number;\n\n /** Vertical scroll amount */\n public deltaY: number;\n\n /** z-axis scroll amount. */\n public deltaZ: number;\n\n /**\n * Units specified in pixels.\n * @ignore\n */\n public static readonly DOM_DELTA_PIXEL = 0;\n\n /**\n * Units specified in pixels.\n * @ignore\n */\n public readonly DOM_DELTA_PIXEL = 0;\n\n /**\n * Units specified in lines.\n * @ignore\n */\n public static readonly DOM_DELTA_LINE = 1;\n\n /**\n * Units specified in lines.\n * @ignore\n */\n public readonly DOM_DELTA_LINE = 1;\n\n /**\n * Units specified in pages.\n * @ignore\n */\n public static readonly DOM_DELTA_PAGE = 2;\n\n /**\n * Units specified in pages.\n * @ignore\n */\n public readonly DOM_DELTA_PAGE = 2;\n}\n"],"names":[],"mappings":";;;AAiDO,MAAM,4BAA4B,mBACzC,CAAA;AAAA,EADO,WAAA,GAAA;AAAA,IAAA,KAAA,CAAA,GAAA,SAAA,CAAA,CAAA;AA2BH;AAAA;AAAA;AAAA;AAAA,IAAA,IAAA,CAAgB,eAAkB,GAAA,CAAA,CAAA;AAYlC;AAAA;AAAA;AAAA;AAAA,IAAA,IAAA,CAAgB,cAAiB,GAAA,CAAA,CAAA;AAYjC;AAAA;AAAA;AAAA;AAAA,IAAA,IAAA,CAAgB,cAAiB,GAAA,CAAA,CAAA;AAAA,GAAA;AACrC,CAAA;AAAA;AAAA;AAAA;AAAA;AApDa,mBAAA,CAqBc,eAAkB,GAAA,CAAA,CAAA;AAAA;AAAA;AAAA;AAAA;AArBhC,mBAAA,CAiCc,cAAiB,GAAA,CAAA,CAAA;AAAA;AAAA;AAAA;AAAA;AAjC/B,mBAAA,CA6Cc,cAAiB,GAAA,CAAA;;;;"}