Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@pixi/events

Package Overview
Dependencies
Maintainers
2
Versions
74
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pixi/events - npm Package Compare versions

Comparing version 7.1.2 to 7.2.0-beta

lib/EventTicker.d.ts

9

global.d.ts

@@ -29,2 +29,11 @@ declare namespace GlobalMixins

interface IRendererOptions
{
/**
* The default event mode for all display objects.
* @since 7.2.0
*/
eventMode?: import('@pixi/events').EventMode;
}
interface CanvasRenderer

@@ -31,0 +40,0 @@ {

84

lib/EventBoundary.d.ts

@@ -6,3 +6,3 @@ import { Point, utils } from '@pixi/core';

import type { FederatedEvent } from './FederatedEvent';
import type { Cursor, FederatedEventTarget } from './FederatedEventTarget';
import type { Cursor, EventMode, FederatedEventTarget } from './FederatedEventTarget';
/**

@@ -148,5 +148,3 @@ * The tracking data for each pointer held in the state of an {@link PIXI.EventBoundary}.

protected eventPool: Map<typeof FederatedEvent, FederatedEvent[]>;
/**
* @param rootTarget - The holder of the event boundary.
*/
/** @param rootTarget - The holder of the event boundary. */
constructor(rootTarget?: DisplayObject);

@@ -186,3 +184,3 @@ /**

/**
* Propagate the passed event from from {@link EventBoundary.rootTarget this.rootTarget} to its
* Propagate the passed event from from {@link PIXI.EventBoundary.rootTarget this.rootTarget} to its
* target {@code e.target}.

@@ -194,3 +192,3 @@ * @param e - The event to propagate.

/**
* Emits the event {@link e} to all display objects. The event is propagated in the bubbling phase always.
* Emits the event {@code e} to all display objects. The event is propagated in the bubbling phase always.
*

@@ -210,5 +208,5 @@ * This is used in the `pointermove` legacy mode.

/**
* Recursive implementation for {@link EventBoundary.hitTest hitTest}.
* Recursive implementation for {@link PIXI.EventBoundary.hitTest hitTest}.
* @param currentTarget - The DisplayObject that is to be hit tested.
* @param interactive - Flags whether `currentTarget` or one of its parents are interactive.
* @param eventMode - The event mode for the `currentTarget` or one of its parents.
* @param location - The location that is being tested for overlap.

@@ -221,10 +219,11 @@ * @param testFn - Callback that determines whether the target passes hit testing. This callback

* @returns An array holding the hit testing target and all its ancestors in order. The first element
* is the target itself and the last is {@link EventBoundary.rootTarget rootTarget}. This is the opposite
* is the target itself and the last is {@link PIXI.EventBoundary.rootTarget rootTarget}. This is the opposite
* order w.r.t. the propagation path. If no hit testing target is found, null is returned.
*/
protected hitTestRecursive(currentTarget: DisplayObject, interactive: boolean, location: Point, testFn: (object: DisplayObject, pt: Point) => boolean, pruneFn?: (object: DisplayObject, pt: Point) => boolean): DisplayObject[];
protected hitTestRecursive(currentTarget: DisplayObject, eventMode: EventMode, location: Point, testFn: (object: DisplayObject, pt: Point) => boolean, pruneFn?: (object: DisplayObject, pt: Point) => boolean): DisplayObject[];
private _isInteractive;
/**
* Checks whether the display object or any of its children cannot pass the hit test at all.
*
* {@link EventBoundary}'s implementation uses the {@link PIXI.DisplayObject.hitArea hitArea}
* {@link PIXI.EventBoundary}'s implementation uses the {@link PIXI.DisplayObject.hitArea hitArea}
* and {@link PIXI.DisplayObject._mask} for pruning.

@@ -295,4 +294,4 @@ * @param displayObject

*
* (The most specific ancestor of the `pointerdown` event and the `pointerup` event must the {@code EventBoundary}'s
* root because the `pointerup` event occurred outside of the boundary.)
* (The most specific ancestor of the `pointerdown` event and the `pointerup` event must the
* `{@link PIXI.EventBoundary}'s root because the `pointerup` event occurred outside of the boundary.)
*

@@ -434,3 +433,3 @@ * `touchendoutside`, `mouseupoutside`, and `rightupoutside` events are fired as well for specific pointer

/**
* Similar to {@link EventEmitter.emit}, except it stops if the `propagationImmediatelyStopped` flag
* Similar to {@link PIXI.EventEmitter.emit}, except it stops if the `propagationImmediatelyStopped` flag
* is set on the event.

@@ -445,3 +444,3 @@ * @param e - The event to call each listener with.

* Fired when a mouse button (usually a mouse left-button) is pressed on the display.
* object. DisplayObject's `interactive` property must be set to `true` to fire event.
* object. DisplayObject's `eventMode` property must be set to `static` or 'dynamic' to fire event.
*

@@ -461,3 +460,3 @@ * These events are propagating from the {@link PIXI.EventSystem EventSystem} in @pixi/events.

* Fired when a pointer device secondary button (usually a mouse right-button) is pressed
* on the display object. DisplayObject's `interactive` property must be set to `true` to fire event.
* on the display object. DisplayObject's `eventMode` property must be set to `static` or 'dynamic' to fire event.
*

@@ -477,3 +476,3 @@ * These events are propagating from the {@link PIXI.EventSystem EventSystem} in @pixi/events.

* Fired when a pointer device button (usually a mouse left-button) is released over the display
* object. DisplayObject's `interactive` property must be set to `true` to fire event.
* object. DisplayObject's `eventMode` property must be set to `static` or 'dynamic' to fire event.
*

@@ -493,3 +492,3 @@ * These events are propagating from the {@link PIXI.EventSystem EventSystem} in @pixi/events.

* Fired when a pointer device secondary button (usually a mouse right-button) is released
* over the display object. DisplayObject's `interactive` property must be set to `true` to fire event.
* over the display object. DisplayObject's `eventMode` property must be set to `static` or 'dynamic' to fire event.
*

@@ -509,3 +508,3 @@ * These events are propagating from the {@link PIXI.EventSystem EventSystem} in @pixi/events.

* Fired when a pointer device button (usually a mouse left-button) is pressed and released on
* the display object. DisplayObject's `interactive` property must be set to `true` to fire event.
* the display object. DisplayObject's `eventMode` property must be set to `static` or 'dynamic' to fire event.
*

@@ -532,3 +531,4 @@ * A {@code click} event fires after the {@code pointerdown} and {@code pointerup} events, in that

* Fired when a pointer device secondary button (usually a mouse right-button) is pressed
* and released on the display object. DisplayObject's `interactive` property must be set to `true` to fire event.
* and released on the display object. DisplayObject's `eventMode`
* property must be set to `static` or 'dynamic' to fire event.
*

@@ -552,3 +552,3 @@ * This event follows the semantics of {@code click}.

* [mousedown]{@link PIXI.DisplayObject#event:mousedown}.
* DisplayObject's `interactive` property must be set to `true` to fire event.
* DisplayObject's `eventMode` property must be set to `static` or 'dynamic' to fire event.
*

@@ -574,3 +574,3 @@ * This event is specific to the Federated Events API. It does not have a capture phase, unlike most of the

* [rightdown]{@link PIXI.DisplayObject#event:rightdown}.
* DisplayObject's `interactive` property must be set to `true` to fire event.
* DisplayObject's `eventMode` property must be set to `static` or 'dynamic' to fire event.
*

@@ -590,3 +590,3 @@ * These events are propagating from the {@link PIXI.EventSystem EventSystem} in @pixi/events.

* Fired when a pointer device (usually a mouse) is moved globally over the scene.
* DisplayObject's `interactive` property must be set to `true` to fire event.
* DisplayObject's `eventMode` property must be set to `static` or 'dynamic' to fire event.
*

@@ -599,3 +599,3 @@ * These events are propagating from the {@link PIXI.EventSystem EventSystem} in @pixi/events.

* Fired when a pointer device (usually a mouse) is moved while over the display object.
* DisplayObject's `interactive` property must be set to `true` to fire event.
* DisplayObject's `eventMode` property must be set to `static` or 'dynamic' to fire event.
*

@@ -615,3 +615,3 @@ * These events are propagating from the {@link PIXI.EventSystem EventSystem} in @pixi/events.

* Fired when a pointer device (usually a mouse) is moved onto the display object.
* DisplayObject's `interactive` property must be set to `true` to fire event.
* DisplayObject's `eventMode` property must be set to `static` or 'dynamic' to fire event.
*

@@ -645,3 +645,3 @@ * These events are propagating from the {@link PIXI.EventSystem EventSystem} in @pixi/events.

* Fired when a pointer device (usually a mouse) is moved off the display object.
* DisplayObject's `interactive` property must be set to `true` to fire event.
* DisplayObject's `eventMode` property must be set to `static` or 'dynamic' to fire event.
*

@@ -678,3 +678,3 @@ * This may be fired on a DisplayObject that was removed from the scene graph immediately after

* Fired when a pointer device button is pressed on the display object.
* DisplayObject's `interactive` property must be set to `true` to fire event.
* DisplayObject's `eventMode` property must be set to `static` or 'dynamic' to fire event.
*

@@ -694,3 +694,3 @@ * These events are propagating from the {@link PIXI.EventSystem EventSystem} in @pixi/events.

* Fired when a pointer device button is released over the display object.
* DisplayObject's `interactive` property must be set to `true` to fire event.
* DisplayObject's `eventMode` property must be set to `static` or 'dynamic' to fire event.
*

@@ -710,3 +710,3 @@ * These events are propagating from the {@link PIXI.EventSystem EventSystem} in @pixi/events.

* Fired when the operating system cancels a pointer event.
* DisplayObject's `interactive` property must be set to `true` to fire event.
* DisplayObject's `eventMode` property must be set to `static` or 'dynamic' to fire event.
*

@@ -726,3 +726,3 @@ * These events are propagating from the {@link PIXI.EventSystem EventSystem} in @pixi/events.

* Fired when a pointer device button is pressed and released on the display object.
* DisplayObject's `interactive` property must be set to `true` to fire event.
* DisplayObject's `eventMode` property must be set to `static` or 'dynamic' to fire event.
*

@@ -743,3 +743,3 @@ * These events are propagating from the {@link PIXI.EventSystem EventSystem} in @pixi/events.

* registered a [pointerdown]{@link PIXI.DisplayObject#event:pointerdown}.
* DisplayObject's `interactive` property must be set to `true` to fire event.
* DisplayObject's `eventMode` property must be set to `static` or 'dynamic' to fire event.
*

@@ -763,3 +763,3 @@ * This event is specific to the Federated Events API. It does not have a capture phase, unlike most of the

* Fired when a pointer device is moved globally over the scene.
* DisplayObject's `interactive` property must be set to `true` to fire event.
* DisplayObject's `eventMode` property must be set to `static` or 'dynamic' to fire event.
*

@@ -772,3 +772,3 @@ * These events are propagating from the {@link PIXI.EventSystem EventSystem} in @pixi/events.

* Fired when a pointer device is moved while over the display object.
* DisplayObject's `interactive` property must be set to `true` to fire event.
* DisplayObject's `eventMode` property must be set to `static` or 'dynamic' to fire event.
*

@@ -788,3 +788,3 @@ * These events are propagating from the {@link PIXI.EventSystem EventSystem} in @pixi/events.

* Fired when a pointer device is moved onto the display object.
* DisplayObject's `interactive` property must be set to `true` to fire event.
* DisplayObject's `eventMode` property must be set to `static` or 'dynamic' to fire event.
*

@@ -818,3 +818,3 @@ * These events are propagating from the {@link PIXI.EventSystem EventSystem} in @pixi/events.

* Fired when a pointer device is moved off the display object.
* DisplayObject's `interactive` property must be set to `true` to fire event.
* DisplayObject's `eventMode` property must be set to `static` or 'dynamic' to fire event.
*

@@ -850,3 +850,3 @@ * These events are propagating from the {@link PIXI.EventSystem EventSystem} in @pixi/events.

* Fired when a touch point is placed on the display object.
* DisplayObject's `interactive` property must be set to `true` to fire event.
* DisplayObject's `eventMode` property must be set to `static` or 'dynamic' to fire event.
*

@@ -866,3 +866,3 @@ * These events are propagating from the {@link PIXI.EventSystem EventSystem} in @pixi/events.

* Fired when a touch point is removed from the display object.
* DisplayObject's `interactive` property must be set to `true` to fire event.
* DisplayObject's `eventMode` property must be set to `static` or 'dynamic' to fire event.
*

@@ -882,3 +882,3 @@ * These events are propagating from the {@link PIXI.EventSystem EventSystem} in @pixi/events.

* Fired when the operating system cancels a touch.
* DisplayObject's `interactive` property must be set to `true` to fire event.
* DisplayObject's `eventMode` property must be set to `static` or 'dynamic' to fire event.
*

@@ -898,3 +898,3 @@ * These events are propagating from the {@link PIXI.EventSystem EventSystem} in @pixi/events.

* Fired when a touch point is placed and removed from the display object.
* DisplayObject's `interactive` property must be set to `true` to fire event.
* DisplayObject's `eventMode` property must be set to `static` or 'dynamic' to fire event.
*

@@ -915,3 +915,3 @@ * These events are propagating from the {@link PIXI.EventSystem EventSystem} in @pixi/events.

* registered a [touchstart]{@link PIXI.DisplayObject#event:touchstart}.
* DisplayObject's `interactive` property must be set to `true` to fire event.
* DisplayObject's `eventMode` property must be set to `static` or 'dynamic' to fire event.
*

@@ -931,3 +931,3 @@ * These events are propagating from the {@link PIXI.EventSystem EventSystem} in @pixi/events.

* Fired when a touch point is moved globally over the scene.
* DisplayObject's `interactive` property must be set to `true` to fire event.
* DisplayObject's `eventMode` property must be set to `static` or 'dynamic' to fire event.
*

@@ -940,3 +940,3 @@ * These events are propagating from the {@link PIXI.EventSystem EventSystem} in @pixi/events.

* Fired when a touch point is moved along the display object.
* DisplayObject's `interactive` property must be set to `true` to fire event.
* DisplayObject's `eventMode` property must be set to `static` or 'dynamic' to fire event.
*

@@ -943,0 +943,0 @@ * These events are propagating from the {@link PIXI.EventSystem EventSystem} in @pixi/events.

@@ -6,2 +6,3 @@ 'use strict';

var core = require('@pixi/core');
var EventTicker = require('./EventTicker.js');
var FederatedMouseEvent = require('./FederatedMouseEvent.js');

@@ -72,3 +73,4 @@ var FederatedPointerEvent = require('./FederatedPointerEvent.js');

hitTest(x, y) {
const invertedPath = this.hitTestRecursive(this.rootTarget, this.rootTarget.interactive, tempHitLocation.set(x, y), this.hitTestFn, this.hitPruneFn);
EventTicker.EventsTicker.pauseUpdate = true;
const invertedPath = this.hitTestRecursive(this.rootTarget, this.rootTarget.eventMode, tempHitLocation.set(x, y), this.hitTestFn, this.hitPruneFn);
return invertedPath && invertedPath[0];

@@ -104,5 +106,11 @@ }

const children = target.children;
if (children) {
for (let i = 0; i < children.length; i++) {
this.all(e, type, children[i]);
const interactionNone = target.eventMode === "none";
const interactionPassive = target.eventMode === "passive" && !target.interactiveChildren;
const interactiveChildren = target.interactiveChildren;
const shouldIterateChildren = !interactionNone && interactiveChildren && !interactionPassive;
if (children && children.length > 0) {
if (shouldIterateChildren) {
for (let i = 0; i < children.length; i++) {
this.all(e, type, children[i]);
}
}

@@ -125,3 +133,3 @@ }

}
hitTestRecursive(currentTarget, interactive, location, testFn, pruneFn) {
hitTestRecursive(currentTarget, eventMode, location, testFn, pruneFn) {
if (!currentTarget || !currentTarget.visible) {

@@ -133,2 +141,5 @@ return null;

}
if (currentTarget.eventMode === "dynamic" || eventMode === "dynamic") {
EventTicker.EventsTicker.pauseUpdate = false;
}
if (currentTarget.interactiveChildren && currentTarget.children) {

@@ -138,3 +149,3 @@ const children = currentTarget.children;

const child = children[i];
const nestedHit = this.hitTestRecursive(child, interactive || child.interactive, location, testFn, pruneFn);
const nestedHit = this.hitTestRecursive(child, this._isInteractive(eventMode) ? eventMode : child.eventMode, location, testFn, pruneFn);
if (nestedHit) {

@@ -144,3 +155,3 @@ if (nestedHit.length > 0 && !nestedHit[nestedHit.length - 1].parent) {

}
if (nestedHit.length > 0 || currentTarget.interactive) {
if (nestedHit.length > 0 || currentTarget.isInteractive()) {
nestedHit.push(currentTarget);

@@ -152,8 +163,20 @@ }

}
if (interactive && testFn(currentTarget, location)) {
return currentTarget.interactive ? [currentTarget] : [];
if (this._isInteractive(eventMode) && testFn(currentTarget, location)) {
return currentTarget.isInteractive() ? [currentTarget] : [];
}
return null;
}
_isInteractive(int) {
return int === "static" || int === "dynamic";
}
hitPruneFn(displayObject, location) {
if (displayObject.eventMode === "none") {
return true;
}
if (displayObject.eventMode === "passive" && !displayObject.interactiveChildren) {
return true;
}
if (displayObject.isMask) {
return true;
}
if (displayObject.hitArea) {

@@ -174,2 +197,5 @@ displayObject.worldTransform.applyInverse(location, tempLocalMapping);

hitTestFn(displayObject, location) {
if (displayObject.eventMode === "passive") {
return false;
}
if (displayObject.hitArea) {

@@ -558,2 +584,4 @@ return true;

return;
if (!e.currentTarget.isInteractive())
return;
if ("fn" in listeners) {

@@ -560,0 +588,0 @@ listeners.fn.call(listeners.context, e);

import { EventBoundary } from './EventBoundary';
import { FederatedWheelEvent } from './FederatedWheelEvent';
import type { ExtensionMetadata, ICanvas, IPointData, IRenderableObject } from '@pixi/core';
interface Renderer {
lastObjectRendered: IRenderableObject;
view: ICanvas;
resolution: number;
plugins: Record<string, any>;
import type { ExtensionMetadata, IPointData, IRenderer, ISystem } from '@pixi/core';
import type { EventMode } from './FederatedEventTarget';
/** @ignore */
export interface EventSystemOptions {
/**
* The default event mode mode for all display objects.
* This option only is available when using **@pixi/events** package
* (included in the **pixi.js** and **pixi.js-legacy** bundle), otherwise it will be ignored.
* @memberof PIXI.IRendererOptions
*/
eventMode?: EventMode;
}

@@ -14,6 +19,15 @@ /**

*/
export declare class EventSystem {
export declare class EventSystem implements ISystem<EventSystemOptions> {
/** @ignore */
static extension: ExtensionMetadata;
private static _defaultEventMode;
/**
* The default interaction mode for all display objects.
* @see PIXI.DisplayObject.eventMode
* @type {PIXI.EventMode}
* @readonly
* @since 7.2.0
*/
static get defaultEventMode(): EventMode;
/**
* The {@link PIXI.EventBoundary} for the stage.

@@ -55,4 +69,4 @@ *

resolution: number;
/** The renderer managing this {@link EventSystem}. */
renderer: Renderer;
/** The renderer managing this {@link PIXI.EventSystem}. */
renderer: IRenderer;
private currentCursor;

@@ -65,3 +79,3 @@ private rootPointerEvent;

*/
constructor(renderer: Renderer);
constructor(renderer: IRenderer);
/**

@@ -71,3 +85,3 @@ * Runner init called, view is available at this point.

*/
init(): void;
init(options: EventSystemOptions): void;
/**

@@ -106,3 +120,3 @@ * Handle changing resolution.

/**
* Passive handler for `wheel` events on {@link EventSystem.domElement this.domElement}.
* Passive handler for `wheel` events on {@link PIXI.EventSystem.domElement this.domElement}.
* @param nativeEvent - The native wheel event.

@@ -148,3 +162,3 @@ */

/**
* Normalizes the {@code nativeEvent} into a federateed {@code FederatedPointerEvent}.
* Normalizes the `nativeEvent` into a federateed {@link PIXI.FederatedPointerEvent}.
* @param event

@@ -161,2 +175,1 @@ * @param nativeEvent

}
export {};

@@ -7,2 +7,3 @@ 'use strict';

var EventBoundary = require('./EventBoundary.js');
var EventTicker = require('./EventTicker.js');
var FederatedPointerEvent = require('./FederatedPointerEvent.js');

@@ -19,3 +20,3 @@ var FederatedWheelEvent = require('./FederatedWheelEvent.js');

};
class EventSystem {
const _EventSystem = class {
constructor(renderer) {

@@ -28,2 +29,3 @@ this.supportsTouchEvents = "ontouchstart" in globalThis;

this.rootBoundary = new EventBoundary.EventBoundary(null);
EventTicker.EventsTicker.init(this);
this.autoPreventDefault = true;

@@ -43,6 +45,10 @@ this.eventsAdded = false;

}
init() {
static get defaultEventMode() {
return this._defaultEventMode;
}
init(options) {
const { view, resolution } = this.renderer;
this.setTargetElement(view);
this.resolution = resolution;
_EventSystem._defaultEventMode = options.eventMode ?? "auto";
}

@@ -109,2 +115,3 @@ resolutionChange(resolution) {

return;
EventTicker.EventsTicker.pointerMoved();
const normalizedEvents = this.normalizeToPointerData(nativeEvent);

@@ -153,2 +160,3 @@ for (let i = 0, j = normalizedEvents.length; i < j; i++) {

this.domElement = element;
EventTicker.EventsTicker.domElement = element;
this.addEvents();

@@ -160,2 +168,3 @@ }

}
EventTicker.EventsTicker.addTickerListener();
const style = this.domElement.style;

@@ -198,2 +207,3 @@ if (style) {

}
EventTicker.EventsTicker.removeTickerListener();
const style = this.domElement.style;

@@ -375,3 +385,4 @@ if (globalThis.navigator.msPointerEnabled) {

}
}
};
let EventSystem = _EventSystem;
EventSystem.extension = {

@@ -378,0 +389,0 @@ name: "events",

@@ -16,3 +16,3 @@ import { Point } from '@pixi/core';

/**
* Flags whether this event can be canceled using {@link FederatedEvent.preventDefault}. This is always
* Flags whether this event can be canceled using {@link PIXI.FederatedEvent.preventDefault}. This is always
* false (for now).

@@ -33,3 +33,3 @@ */

* The propagation phase.
* @default {@link FederatedEvent.NONE}
* @default {@link PIXI.FederatedEvent.NONE}
*/

@@ -59,3 +59,3 @@ eventPhase: number;

path: FederatedEventTarget[];
/** The {@link EventBoundary} that manages this event. Null for root events. */
/** The {@link PIXI.EventBoundary} that manages this event. Null for root events. */
readonly manager: EventBoundary;

@@ -89,7 +89,7 @@ /** Event-specific detail */

/**
* Fallback for the deprecated {@link PIXI.InteractionEvent.data}.
* Fallback for the deprecated @code{PIXI.InteractionEvent.data}.
* @deprecated since 7.0.0
*/
get data(): this;
/** The propagation path for this event. Alias for {@link EventBoundary.propagationPath}. */
/** The propagation path for this event. Alias for {@link PIXI.EventBoundary.propagationPath}. */
composedPath(): FederatedEventTarget[];

@@ -118,3 +118,3 @@ /**

* Stop this event from propagating to any addition listeners, including on the
* {@link FederatedEventTarget.currentTarget currentTarget} and also the following
* {@link PIXI.FederatedEventTarget.currentTarget currentTarget} and also the following
* event targets on the propagation path.

@@ -124,4 +124,4 @@ */

/**
* Stop this event from propagating to the next {@link FederatedEventTarget}. The rest of the listeners
* on the {@link FederatedEventTarget.currentTarget currentTarget} will still be notified.
* Stop this event from propagating to the next {@link PIXI.FederatedEventTarget}. The rest of the listeners
* on the {@link PIXI.FederatedEventTarget.currentTarget currentTarget} will still be notified.
*/

@@ -128,0 +128,0 @@ stopPropagation(): void;

@@ -9,8 +9,18 @@ import type { utils } from '@pixi/core';

}
/** Function type for handlers, e.g., onclick */
/**
* Function type for handlers, e.g., onclick
* @memberof PIXI
*/
export declare type FederatedEventHandler<T = FederatedPointerEvent> = (event: T) => void;
/**
* Describes the shape for a {@link FederatedEvent}'s' `eventTarget`.
* The type of interaction a DisplayObject can be. For more information on values and their meaning,
* see {@link PIXI.DisplayObject.eventMode DisplayObject's eventMode property}.
* @memberof PIXI
* @since 7.2.0
*/
export declare type EventMode = 'none' | 'passive' | 'auto' | 'static' | 'dynamic';
/**
* Describes the shape for a {@link PIXI.FederatedEvent}'s' `eventTarget`.
* @memberof PIXI
*/
export interface FederatedEventTarget extends utils.EventEmitter, EventTarget {

@@ -25,2 +35,8 @@ /** The cursor preferred when the mouse pointer is hovering over. */

interactive: boolean;
_internalInteractive: boolean;
/** The mode of interaction for this object */
eventMode: EventMode;
_internalEventMode: EventMode;
/** Returns true if the DisplayObject has interactive 'static' or 'dynamic' */
isInteractive: () => boolean;
/** Whether this event target has any children that need UI events. This can be used optimize event propagation. */

@@ -27,0 +43,0 @@ interactiveChildren: boolean;

@@ -6,4 +6,9 @@ 'use strict';

var display = require('@pixi/display');
var utils = require('@pixi/utils');
var EventSystem = require('./EventSystem.js');
var FederatedEvent = require('./FederatedEvent.js');
function convertEventModeToInteractiveMode(mode) {
return mode === "dynamic" || mode === "static";
}
const FederatedDisplayObject = {

@@ -43,3 +48,22 @@ onclick: null,

onwheel: null,
interactive: false,
_internalInteractive: void 0,
get interactive() {
return this._internalInteractive ?? convertEventModeToInteractiveMode(EventSystem.EventSystem.defaultEventMode);
},
set interactive(value) {
utils.deprecation("7.2.0", `Setting interactive is deprecated, use eventMode = 'none'/'passive'/'auto'/'static'/'dynamic' instead.`);
this._internalInteractive = value;
this.eventMode = value ? "static" : "auto";
},
_internalEventMode: void 0,
get eventMode() {
return this._internalEventMode ?? EventSystem.EventSystem.defaultEventMode;
},
set eventMode(value) {
this._internalInteractive = convertEventModeToInteractiveMode(value);
this._internalEventMode = value;
},
isInteractive() {
return this.eventMode === "static" || this.eventMode === "dynamic";
},
interactiveChildren: true,

@@ -46,0 +70,0 @@ hitArea: null,

import { Point } from '@pixi/core';
import { FederatedEvent } from './FederatedEvent';
import type { IPointData } from '@pixi/core';
import type { DisplayObject } from '@pixi/display';
/**

@@ -29,3 +31,3 @@ * A {@link PIXI.FederatedEvent} for mouse events.

/**
* Alias for {@link FederatedMouseEvent.clientX this.clientX}.
* Alias for {@link PIXI.FederatedMouseEvent.clientX this.clientX}.
* @readonly

@@ -35,3 +37,3 @@ */

/**
* Alias for {@link FederatedMouseEvent.clientY this.clientY}.
* Alias for {@link PIXI.FederatedMouseEvent.clientY this.clientY}.
* @readonly

@@ -79,2 +81,14 @@ */

/**
* This will return the local coordinates of the specified displayObject for this InteractionData
* @param {PIXI.DisplayObject} displayObject - The DisplayObject that you would like the local
* coords off
* @param {PIXI.IPointData} point - A Point object in which to store the value, optional (otherwise
* will create a new point)
* @param {PIXI.IPointData} globalPos - A Point object containing your custom global coords, optional
* (otherwise will use the current global coords)
* @returns - A point containing the coordinates of the InteractionData position relative
* to the DisplayObject
*/
getLocalPosition<P extends IPointData = Point>(displayObject: DisplayObject, point?: P, globalPos?: IPointData): P;
/**
* Whether the modifier key was pressed when this event natively occurred.

@@ -81,0 +95,0 @@ * @param key - The modifier key.

@@ -53,2 +53,5 @@ 'use strict';

}
getLocalPosition(displayObject, point, globalPos) {
return displayObject.worldTransform.applyInverse(globalPos || this.global, point);
}
getModifierState(key) {

@@ -55,0 +58,0 @@ return "getModifierState" in this.nativeEvent && this.nativeEvent.getModifierState(key);

@@ -18,8 +18,14 @@ import { FederatedMouseEvent } from './FederatedMouseEvent';

deltaZ: number;
/** Units specified in pixels. */
static readonly DOM_DELTA_PIXEL = 0;
/** Units specified in pixels. */
readonly DOM_DELTA_PIXEL = 0;
/** Units specified in lines. */
DOM_DELTA_LINE: number;
static readonly DOM_DELTA_LINE = 1;
/** Units specified in lines. */
readonly DOM_DELTA_LINE = 1;
/** Units specified in pages. */
DOM_DELTA_PAGE: number;
/** Units specified in pixels. */
DOM_DELTA_PIXEL: number;
static readonly DOM_DELTA_PAGE = 2;
/** Units specified in pages. */
readonly DOM_DELTA_PAGE = 2;
}

@@ -10,9 +10,12 @@ 'use strict';

super(...arguments);
this.DOM_DELTA_LINE = 0;
this.DOM_DELTA_PAGE = 1;
this.DOM_DELTA_PIXEL = 2;
this.DOM_DELTA_PIXEL = 0;
this.DOM_DELTA_LINE = 1;
this.DOM_DELTA_PAGE = 2;
}
}
FederatedWheelEvent.DOM_DELTA_PIXEL = 0;
FederatedWheelEvent.DOM_DELTA_LINE = 1;
FederatedWheelEvent.DOM_DELTA_PAGE = 2;
exports.FederatedWheelEvent = FederatedWheelEvent;
//# sourceMappingURL=FederatedWheelEvent.js.map
{
"name": "@pixi/events",
"version": "7.1.2",
"version": "7.2.0-beta",
"main": "lib/index.js",

@@ -47,5 +47,5 @@ "module": "lib/index.mjs",

"@pixi/core",
"@pixi/display"
],
"gitHead": "27e65c73bb36a06fd00d6da5bf460bbee9f6c984"
"@pixi/display",
"@pixi/utils"
]
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc