index.d.ts 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634
  1. /// <reference path="./global.d.ts" />
  2. import type { AbstractRenderer } from '@pixi/core';
  3. import type { Dict } from '@pixi/utils';
  4. import { DisplayObject } from '@pixi/display';
  5. import { EventEmitter } from '@pixi/utils';
  6. import type { ExtensionMetadata } from '@pixi/core';
  7. import type { IPointData } from '@pixi/math';
  8. import { Point } from '@pixi/math';
  9. declare type Cursor = 'auto' | 'default' | 'none' | 'context-menu' | 'help' | 'pointer' | 'progress' | 'wait' | 'cell' | 'crosshair' | 'text' | 'vertical-text' | 'alias' | 'copy' | 'move' | 'no-drop' | 'not-allowed' | 'e-resize' | 'n-resize' | 'ne-resize' | 'nw-resize' | 's-resize' | 'se-resize' | 'sw-resize' | 'w-resize' | 'ns-resize' | 'ew-resize' | 'nesw-resize' | 'col-resize' | 'nwse-resize' | 'row-resize' | 'all-scroll' | 'zoom-in' | 'zoom-out' | 'grab' | 'grabbing';
  10. export declare interface DelayedEvent {
  11. displayObject: DisplayObject;
  12. eventString: string;
  13. eventData: InteractionEvent;
  14. }
  15. export declare interface IHitArea {
  16. contains(x: number, y: number): boolean;
  17. }
  18. export declare type InteractionCallback = (interactionEvent: InteractionEvent, displayObject: DisplayObject, hit?: boolean) => void;
  19. /**
  20. * Holds all information related to an Interaction event
  21. * @memberof PIXI
  22. */
  23. export declare class InteractionData {
  24. /** This point stores the global coords of where the touch/mouse event happened. */
  25. global: Point;
  26. /** The target Sprite that was interacted with. */
  27. target: DisplayObject;
  28. /**
  29. * When passed to an event handler, this will be the original DOM Event that was captured
  30. * @see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent
  31. * @see https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent
  32. * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent
  33. * @member {MouseEvent|TouchEvent|PointerEvent}
  34. */
  35. originalEvent: InteractivePointerEvent;
  36. /** Unique identifier for this interaction. */
  37. identifier: number;
  38. /**
  39. * Indicates whether or not the pointer device that created the event is the primary pointer.
  40. * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/isPrimary
  41. */
  42. isPrimary: boolean;
  43. /**
  44. * Indicates which button was pressed on the mouse or pointer device to trigger the event.
  45. * @see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button
  46. */
  47. button: number;
  48. /**
  49. * Indicates which buttons are pressed on the mouse or pointer device when the event is triggered.
  50. * @see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/buttons
  51. */
  52. buttons: number;
  53. /**
  54. * The width of the pointer's contact along the x-axis, measured in CSS pixels.
  55. * radiusX of TouchEvents will be represented by this value.
  56. * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/width
  57. */
  58. width: number;
  59. /**
  60. * The height of the pointer's contact along the y-axis, measured in CSS pixels.
  61. * radiusY of TouchEvents will be represented by this value.
  62. * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/height
  63. */
  64. height: number;
  65. /**
  66. * The angle, in degrees, between the pointer device and the screen.
  67. * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/tiltX
  68. */
  69. tiltX: number;
  70. /**
  71. * The angle, in degrees, between the pointer device and the screen.
  72. * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/tiltY
  73. */
  74. tiltY: number;
  75. /**
  76. * The type of pointer that triggered the event.
  77. * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pointerType
  78. */
  79. pointerType: string;
  80. /**
  81. * Pressure applied by the pointing device during the event. A Touch's force property
  82. * will be represented by this value.
  83. * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pressure
  84. */
  85. pressure: number;
  86. /**
  87. * From TouchEvents (not PointerEvents triggered by touches), the rotationAngle of the Touch.
  88. * @see https://developer.mozilla.org/en-US/docs/Web/API/Touch/rotationAngle
  89. */
  90. rotationAngle: number;
  91. /**
  92. * Twist of a stylus pointer.
  93. * @see https://w3c.github.io/pointerevents/#pointerevent-interface
  94. */
  95. twist: number;
  96. /**
  97. * Barrel pressure on a stylus pointer.
  98. * @see https://w3c.github.io/pointerevents/#pointerevent-interface
  99. */
  100. tangentialPressure: number;
  101. constructor();
  102. /**
  103. * The unique identifier of the pointer. It will be the same as `identifier`.
  104. * @readonly
  105. * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pointerId
  106. */
  107. get pointerId(): number;
  108. /**
  109. * This will return the local coordinates of the specified displayObject for this InteractionData
  110. * @param displayObject - The DisplayObject that you would like the local
  111. * coords off
  112. * @param point - A Point object in which to store the value, optional (otherwise
  113. * will create a new point)
  114. * @param globalPos - A Point object containing your custom global coords, optional
  115. * (otherwise will use the current global coords)
  116. * @returns - A point containing the coordinates of the InteractionData position relative
  117. * to the DisplayObject
  118. */
  119. getLocalPosition<P extends IPointData = Point>(displayObject: DisplayObject, point?: P, globalPos?: IPointData): P;
  120. /**
  121. * Copies properties from normalized event data.
  122. * @param {Touch|MouseEvent|PointerEvent} event - The normalized event data
  123. */
  124. copyEvent(event: Touch | InteractivePointerEvent): void;
  125. /** Resets the data for pooling. */
  126. reset(): void;
  127. }
  128. /**
  129. * Event class that mimics native DOM events.
  130. * @memberof PIXI
  131. */
  132. export declare class InteractionEvent {
  133. /**
  134. * Whether this event will continue propagating in the tree.
  135. *
  136. * Remaining events for the {@link stopsPropagatingAt} object
  137. * will still be dispatched.
  138. */
  139. stopped: boolean;
  140. /**
  141. * At which object this event stops propagating.
  142. * @private
  143. */
  144. stopsPropagatingAt: DisplayObject;
  145. /**
  146. * Whether we already reached the element we want to
  147. * stop propagating at. This is important for delayed events,
  148. * where we start over deeper in the tree again.
  149. * @private
  150. */
  151. stopPropagationHint: boolean;
  152. /**
  153. * The object which caused this event to be dispatched.
  154. * For listener callback see {@link PIXI.InteractionEvent.currentTarget}.
  155. */
  156. target: DisplayObject;
  157. /** The object whose event listener’s callback is currently being invoked. */
  158. currentTarget: DisplayObject;
  159. /** Type of the event. */
  160. type: string;
  161. /** {@link InteractionData} related to this event */
  162. data: InteractionData;
  163. constructor();
  164. /** Prevents event from reaching any objects other than the current object. */
  165. stopPropagation(): void;
  166. /** Resets the event. */
  167. reset(): void;
  168. }
  169. /**
  170. * The interaction manager deals with mouse, touch and pointer events.
  171. *
  172. * Any DisplayObject can be interactive if its `interactive` property is set to true.
  173. *
  174. * This manager also supports multitouch.
  175. *
  176. * An instance of this class is automatically created by default, and can be found at `renderer.plugins.interaction`
  177. * @memberof PIXI
  178. */
  179. export declare class InteractionManager extends EventEmitter {
  180. /** @ignore */
  181. static extension: ExtensionMetadata;
  182. /**
  183. * Actively tracked InteractionData
  184. * @private
  185. * @member {Object<number, PIXI.InteractionData>}
  186. */
  187. readonly activeInteractionData: {
  188. [key: number]: InteractionData;
  189. };
  190. /** Does the device support touch events https://www.w3.org/TR/touch-events/ */
  191. readonly supportsTouchEvents: boolean;
  192. /** Does the device support pointer events https://www.w3.org/Submission/pointer-events/ */
  193. readonly supportsPointerEvents: boolean;
  194. /**
  195. * Pool of unused InteractionData
  196. * @private
  197. */
  198. interactionDataPool: InteractionData[];
  199. /**
  200. * Internal cached let.
  201. * @private
  202. */
  203. cursor: string;
  204. /**
  205. * Delayed pointer events. Used to guarantee correct ordering of over/out events.
  206. * @private
  207. */
  208. delayedEvents: DelayedEvent[];
  209. /**
  210. * TreeSearch component that is used to hitTest stage tree.
  211. * @private
  212. */
  213. search: TreeSearch;
  214. /** The renderer this interaction manager works for. */
  215. renderer: AbstractRenderer;
  216. /**
  217. * Should default browser actions automatically be prevented.
  218. * Does not apply to pointer events for backwards compatibility as
  219. * preventDefault on pointer events stops mouse events from firing.
  220. * Thus, for every pointer event, there will always be either a mouse of touch event alongside it.
  221. * @default true
  222. */
  223. autoPreventDefault: boolean;
  224. /**
  225. * Maximum frequency in milliseconds at which pointer over/out states will be checked by {@link tickerUpdate}.
  226. * @default 10
  227. */
  228. interactionFrequency: number;
  229. /** The mouse data. */
  230. mouse: InteractionData;
  231. /** An event data object to handle all the event tracking/dispatching. */
  232. eventData: InteractionEvent;
  233. /**
  234. * This property determines if mousemove and touchmove events are fired only when the cursor
  235. * is over the object.
  236. * Setting to true will make things work more in line with how the DOM version works.
  237. * Setting to false can make things easier for things like dragging
  238. * It is currently set to false as this is how PixiJS used to work. This will be set to true in
  239. * future versions of pixi.
  240. * @default false
  241. */
  242. moveWhenInside: boolean;
  243. /**
  244. * Dictionary of how different cursor modes are handled. Strings are handled as CSS cursor
  245. * values, objects are handled as dictionaries of CSS values for interactionDOMElement,
  246. * and functions are called instead of changing the CSS.
  247. * Default CSS cursor values are provided for 'default' and 'pointer' modes.
  248. * @member {Object<string, Object>}
  249. */
  250. cursorStyles: Dict<string | ((mode: string) => void) | CSSStyleDeclaration>;
  251. /** The mode of the cursor that is being used. The value of this is a key from the cursorStyles dictionary. */
  252. currentCursorMode: string;
  253. /**
  254. * The current resolution / device pixel ratio.
  255. * @default 1
  256. */
  257. resolution: number;
  258. /** The DOM element to bind to. */
  259. protected interactionDOMElement: HTMLElement;
  260. /** Have events been attached to the dom element? */
  261. protected eventsAdded: boolean;
  262. /** Has the system ticker been added? */
  263. protected tickerAdded: boolean;
  264. /** Is the mouse hovering over the renderer? If working in worker mouse considered to be over renderer by default. */
  265. protected mouseOverRenderer: boolean;
  266. private _useSystemTicker;
  267. private _deltaTime;
  268. private _didMove;
  269. /** Used as a last rendered object in case renderer doesnt have _lastObjectRendered. */
  270. private _tempDisplayObject;
  271. /**
  272. * An options object specifies characteristics about the event listener.
  273. * @member {Object<string, boolean>}
  274. */
  275. private readonly _eventListenerOptions;
  276. /**
  277. * @param {PIXI.CanvasRenderer|PIXI.Renderer} renderer - A reference to the current renderer
  278. * @param options - The options for the manager.
  279. * @param {boolean} [options.autoPreventDefault=true] - Should the manager automatically prevent default browser actions.
  280. * @param {number} [options.interactionFrequency=10] - Maximum frequency (ms) at pointer over/out states will be checked.
  281. * @param {number} [options.useSystemTicker=true] - Whether to add {@link tickerUpdate} to {@link PIXI.Ticker.system}.
  282. */
  283. constructor(renderer: AbstractRenderer, options?: InteractionManagerOptions);
  284. /**
  285. * Should the InteractionManager automatically add {@link tickerUpdate} to {@link PIXI.Ticker.system}.
  286. * @default true
  287. */
  288. get useSystemTicker(): boolean;
  289. set useSystemTicker(useSystemTicker: boolean);
  290. /**
  291. * Last rendered object or temp object.
  292. * @readonly
  293. * @protected
  294. */
  295. get lastObjectRendered(): DisplayObject;
  296. /**
  297. * Hit tests a point against the display tree, returning the first interactive object that is hit.
  298. * @param globalPoint - A point to hit test with, in global space.
  299. * @param root - The root display object to start from. If omitted, defaults
  300. * to the last rendered root of the associated renderer.
  301. * @returns - The hit display object, if any.
  302. */
  303. hitTest(globalPoint: Point, root?: DisplayObject): DisplayObject;
  304. /**
  305. * Sets the DOM element which will receive mouse/touch events. This is useful for when you have
  306. * other DOM elements on top of the renderers Canvas element. With this you'll be bale to delegate
  307. * another DOM element to receive those events.
  308. * @param element - the DOM element which will receive mouse and touch events.
  309. * @param resolution - The resolution / device pixel ratio of the new element (relative to the canvas).
  310. */
  311. setTargetElement(element: HTMLElement, resolution?: number): void;
  312. /** Adds the ticker listener. */
  313. private addTickerListener;
  314. /** Removes the ticker listener. */
  315. private removeTickerListener;
  316. /** Registers all the DOM events. */
  317. private addEvents;
  318. /** Removes all the DOM events that were previously registered. */
  319. private removeEvents;
  320. /**
  321. * Updates the state of interactive objects if at least {@link interactionFrequency}
  322. * milliseconds have passed since the last invocation.
  323. *
  324. * Invoked by a throttled ticker update from {@link PIXI.Ticker.system}.
  325. * @param deltaTime - time delta since the last call
  326. */
  327. tickerUpdate(deltaTime: number): void;
  328. /** Updates the state of interactive objects. */
  329. update(): void;
  330. /**
  331. * Sets the current cursor mode, handling any callbacks or CSS style changes.
  332. * @param mode - cursor mode, a key from the cursorStyles dictionary
  333. */
  334. setCursorMode(mode: string): void;
  335. /**
  336. * Dispatches an event on the display object that was interacted with.
  337. * @param displayObject - the display object in question
  338. * @param eventString - the name of the event (e.g, mousedown)
  339. * @param eventData - the event data object
  340. */
  341. private dispatchEvent;
  342. /**
  343. * Puts a event on a queue to be dispatched later. This is used to guarantee correct
  344. * ordering of over/out events.
  345. * @param displayObject - the display object in question
  346. * @param eventString - the name of the event (e.g, mousedown)
  347. * @param eventData - the event data object
  348. */
  349. private delayDispatchEvent;
  350. /**
  351. * Maps x and y coords from a DOM object and maps them correctly to the PixiJS view. The
  352. * resulting value is stored in the point. This takes into account the fact that the DOM
  353. * element could be scaled and positioned anywhere on the screen.
  354. * @param point - the point that the result will be stored in
  355. * @param x - the x coord of the position to map
  356. * @param y - the y coord of the position to map
  357. */
  358. mapPositionToPoint(point: IPointData, x: number, y: number): void;
  359. /**
  360. * This function is provides a neat way of crawling through the scene graph and running a
  361. * specified function on all interactive objects it finds. It will also take care of hit
  362. * testing the interactive objects and passes the hit across in the function.
  363. * @protected
  364. * @param interactionEvent - event containing the point that
  365. * is tested for collision
  366. * @param displayObject - the displayObject
  367. * that will be hit test (recursively crawls its children)
  368. * @param func - the function that will be called on each interactive object. The
  369. * interactionEvent, displayObject and hit will be passed to the function
  370. * @param hitTest - indicates whether we want to calculate hits
  371. * or just iterate through all interactive objects
  372. */
  373. processInteractive(interactionEvent: InteractionEvent, displayObject: DisplayObject, func?: InteractionCallback, hitTest?: boolean): void;
  374. /**
  375. * Is called when the pointer button is pressed down on the renderer element
  376. * @param originalEvent - The DOM event of a pointer button being pressed down
  377. */
  378. private onPointerDown;
  379. /**
  380. * Processes the result of the pointer down check and dispatches the event if need be
  381. * @param interactionEvent - The interaction event wrapping the DOM event
  382. * @param displayObject - The display object that was tested
  383. * @param hit - the result of the hit test on the display object
  384. */
  385. private processPointerDown;
  386. /**
  387. * Is called when the pointer button is released on the renderer element
  388. * @param originalEvent - The DOM event of a pointer button being released
  389. * @param cancelled - true if the pointer is cancelled
  390. * @param func - Function passed to {@link processInteractive}
  391. */
  392. private onPointerComplete;
  393. /**
  394. * Is called when the pointer button is cancelled
  395. * @param event - The DOM event of a pointer button being released
  396. */
  397. private onPointerCancel;
  398. /**
  399. * Processes the result of the pointer cancel check and dispatches the event if need be
  400. * @param interactionEvent - The interaction event wrapping the DOM event
  401. * @param displayObject - The display object that was tested
  402. */
  403. private processPointerCancel;
  404. /**
  405. * Is called when the pointer button is released on the renderer element
  406. * @param event - The DOM event of a pointer button being released
  407. */
  408. private onPointerUp;
  409. /**
  410. * Processes the result of the pointer up check and dispatches the event if need be
  411. * @param interactionEvent - The interaction event wrapping the DOM event
  412. * @param displayObject - The display object that was tested
  413. * @param hit - the result of the hit test on the display object
  414. */
  415. private processPointerUp;
  416. /**
  417. * Is called when the pointer moves across the renderer element
  418. * @param originalEvent - The DOM event of a pointer moving
  419. */
  420. private onPointerMove;
  421. /**
  422. * Processes the result of the pointer move check and dispatches the event if need be
  423. * @param interactionEvent - The interaction event wrapping the DOM event
  424. * @param displayObject - The display object that was tested
  425. * @param hit - the result of the hit test on the display object
  426. */
  427. private processPointerMove;
  428. /**
  429. * Is called when the pointer is moved out of the renderer element
  430. * @private
  431. * @param {PointerEvent} originalEvent - The DOM event of a pointer being moved out
  432. */
  433. private onPointerOut;
  434. /**
  435. * Processes the result of the pointer over/out check and dispatches the event if need be.
  436. * @param interactionEvent - The interaction event wrapping the DOM event
  437. * @param displayObject - The display object that was tested
  438. * @param hit - the result of the hit test on the display object
  439. */
  440. private processPointerOverOut;
  441. /**
  442. * Is called when the pointer is moved into the renderer element.
  443. * @param originalEvent - The DOM event of a pointer button being moved into the renderer view.
  444. */
  445. private onPointerOver;
  446. /**
  447. * Get InteractionData for a given pointerId. Store that data as well.
  448. * @param event - Normalized pointer event, output from normalizeToPointerData.
  449. * @returns - Interaction data for the given pointer identifier.
  450. */
  451. private getInteractionDataForPointerId;
  452. /**
  453. * Return unused InteractionData to the pool, for a given pointerId
  454. * @param pointerId - Identifier from a pointer event
  455. */
  456. private releaseInteractionDataForPointerId;
  457. /**
  458. * Configure an InteractionEvent to wrap a DOM PointerEvent and InteractionData
  459. * @param interactionEvent - The event to be configured
  460. * @param pointerEvent - The DOM event that will be paired with the InteractionEvent
  461. * @param interactionData - The InteractionData that will be paired
  462. * with the InteractionEvent
  463. * @returns - the interaction event that was passed in
  464. */
  465. private configureInteractionEventForDOMEvent;
  466. /**
  467. * Ensures that the original event object contains all data that a regular pointer event would have
  468. * @param {TouchEvent|MouseEvent|PointerEvent} event - The original event data from a touch or mouse event
  469. * @returns - An array containing a single normalized pointer event, in the case of a pointer
  470. * or mouse event, or a multiple normalized pointer events if there are multiple changed touches
  471. */
  472. private normalizeToPointerData;
  473. /** Destroys the interaction manager. */
  474. destroy(): void;
  475. }
  476. export declare interface InteractionManagerOptions {
  477. autoPreventDefault?: boolean;
  478. interactionFrequency?: number;
  479. useSystemTicker?: boolean;
  480. }
  481. /**
  482. * DisplayObjects with the {@link PIXI.interactiveTarget} mixin use this class to track interactions
  483. * @class
  484. * @private
  485. * @memberof PIXI
  486. */
  487. export declare class InteractionTrackingData {
  488. static FLAGS: Readonly<InteractionTrackingFlags>;
  489. private readonly _pointerId;
  490. private _flags;
  491. /**
  492. * @param {number} pointerId - Unique pointer id of the event
  493. * @private
  494. */
  495. constructor(pointerId: number);
  496. /**
  497. *
  498. * @private
  499. * @param {number} flag - The interaction flag to set
  500. * @param {boolean} yn - Should the flag be set or unset
  501. */
  502. private _doSet;
  503. /**
  504. * Unique pointer id of the event
  505. * @readonly
  506. * @private
  507. * @member {number}
  508. */
  509. get pointerId(): number;
  510. /**
  511. * State of the tracking data, expressed as bit flags
  512. * @private
  513. * @member {number}
  514. */
  515. get flags(): number;
  516. set flags(flags: number);
  517. /**
  518. * Is the tracked event inactive (not over or down)?
  519. * @private
  520. * @member {number}
  521. */
  522. get none(): boolean;
  523. /**
  524. * Is the tracked event over the DisplayObject?
  525. * @private
  526. * @member {boolean}
  527. */
  528. get over(): boolean;
  529. set over(yn: boolean);
  530. /**
  531. * Did the right mouse button come down in the DisplayObject?
  532. * @private
  533. * @member {boolean}
  534. */
  535. get rightDown(): boolean;
  536. set rightDown(yn: boolean);
  537. /**
  538. * Did the left mouse button come down in the DisplayObject?
  539. * @private
  540. * @member {boolean}
  541. */
  542. get leftDown(): boolean;
  543. set leftDown(yn: boolean);
  544. }
  545. export declare interface InteractionTrackingFlags {
  546. OVER: number;
  547. LEFT_DOWN: number;
  548. RIGHT_DOWN: number;
  549. NONE: number;
  550. }
  551. export declare type InteractivePointerEvent = PointerEvent | TouchEvent | MouseEvent;
  552. export declare interface InteractiveTarget {
  553. interactive: boolean;
  554. interactiveChildren: boolean;
  555. hitArea: IHitArea | null;
  556. cursor: Cursor | string;
  557. buttonMode: boolean;
  558. trackedPointers: {
  559. [x: number]: InteractionTrackingData;
  560. };
  561. _trackedPointers: {
  562. [x: number]: InteractionTrackingData;
  563. };
  564. }
  565. /**
  566. * Default property values of interactive objects
  567. * Used by {@link PIXI.InteractionManager} to automatically give all DisplayObjects these properties
  568. * @private
  569. * @name interactiveTarget
  570. * @type {object}
  571. * @memberof PIXI
  572. * @example
  573. * function MyObject() {}
  574. *
  575. * Object.assign(
  576. * DisplayObject.prototype,
  577. * PIXI.interactiveTarget
  578. * );
  579. */
  580. export declare const interactiveTarget: InteractiveTarget;
  581. /**
  582. * Strategy how to search through stage tree for interactive objects
  583. * @memberof PIXI
  584. */
  585. declare class TreeSearch {
  586. private readonly _tempPoint;
  587. constructor();
  588. /**
  589. * Recursive implementation for findHit
  590. * @private
  591. * @param interactionEvent - event containing the point that
  592. * is tested for collision
  593. * @param displayObject - the displayObject
  594. * that will be hit test (recursively crawls its children)
  595. * @param func - the function that will be called on each interactive object. The
  596. * interactionEvent, displayObject and hit will be passed to the function
  597. * @param hitTest - this indicates if the objects inside should be hit test against the point
  598. * @param interactive - Whether the displayObject is interactive
  599. * @returns - Returns true if the displayObject hit the point
  600. */
  601. recursiveFindHit(interactionEvent: InteractionEvent, displayObject: DisplayObject, func?: InteractionCallback, hitTest?: boolean, interactive?: boolean): boolean;
  602. /**
  603. * This function is provides a neat way of crawling through the scene graph and running a
  604. * specified function on all interactive objects it finds. It will also take care of hit
  605. * testing the interactive objects and passes the hit across in the function.
  606. * @private
  607. * @param interactionEvent - event containing the point that
  608. * is tested for collision
  609. * @param displayObject - the displayObject
  610. * that will be hit test (recursively crawls its children)
  611. * @param func - the function that will be called on each interactive object. The
  612. * interactionEvent, displayObject and hit will be passed to the function
  613. * @param hitTest - this indicates if the objects inside should be hit test against the point
  614. * @returns - Returns true if the displayObject hit the point
  615. */
  616. findHit(interactionEvent: InteractionEvent, displayObject: DisplayObject, func?: InteractionCallback, hitTest?: boolean): void;
  617. }
  618. export { }