The system for handling UI events.

Memberof

PIXI

Implements

Constructors

Properties

autoPreventDefault: boolean

Should default browser actions automatically be prevented. Does not apply to pointer events for backwards compatibility preventDefault on pointer events stops mouse events from firing Thus, for every pointer event, there will always be either a mouse of touch event alongside it.

Default

true
cursorStyles: Record<string, string | CSSStyleDeclaration | ((mode) => void)>

Dictionary of how different cursor modes are handled. Strings are handled as CSS cursor values, objects are handled as dictionaries of CSS values for {@code domElement}, and functions are called instead of changing the CSS. Default CSS cursor values are provided for 'default' and 'pointer' modes.

domElement: HTMLElement

The DOM element to which the root event listeners are bound. This is automatically set to the renderer's PIXI.Renderer#view view.

features: EventSystemFeatures

The event features that are enabled by the EventSystem 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.

Since

7.2.0

Example

const app = new PIXI.Application()
app.renderer.events.features.globalMove = false

// to override all features use Object.assign
Object.assign(app.renderer.events.features, {
move: false,
globalMove: false,
click: false,
wheel: false,
})
renderer: IRenderer<ICanvas>

The renderer managing this PIXI.EventSystem.

resolution: number

The resolution used to convert between the DOM client space into world space.

rootBoundary: EventBoundary

The PIXI.EventBoundary for the stage.

The PIXI.EventBoundary#rootTarget rootTarget of this root boundary is automatically set to the last rendered object before any event processing is initiated. This means the main scene needs to be rendered atleast once before UI events will start propagating.

The root boundary should only be changed during initialization. Otherwise, any state held by the event boundary may be lost (like hovered & pressed DisplayObjects).

supportsPointerEvents: boolean

Does the device support pointer events https://www.w3.org/Submission/pointer-events/

supportsTouchEvents: boolean

Does the device support touch events https://www.w3.org/TR/touch-events/

defaultEventFeatures: EventSystemFeatures

The event features that are enabled by the EventSystem 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.

Since

7.2.0

Accessors

  • get pointer(): Readonly<FederatedPointerEvent>
  • The global pointer event. Useful for getting the pointer position without listening to events.

    Returns Readonly<FederatedPointerEvent>

    Since

    7.2.0

  • get defaultEventMode(): EventMode
  • The default interaction mode for all display objects.

    Returns EventMode

    See

    PIXI.DisplayObject.eventMode

    Since

    7.2.0

Methods

  • Destroys all event listeners and detaches the renderer.

    Returns void

  • Maps x and y coords from a DOM object and maps them correctly to the PixiJS view. The resulting value is stored in the point. This takes into account the fact that the DOM element could be scaled and positioned anywhere on the screen.

    Parameters

    • point: IPointData

      the point that the result will be stored in

    • x: number

      the x coord of the position to map

    • y: number

      the y coord of the position to map

    Returns void

  • Sets the current cursor mode, handling any callbacks or CSS style changes.

    Parameters

    • mode: string

      cursor mode, a key from the cursorStyles dictionary

    Returns void

  • Sets the PIXI.EventSystem#domElement domElement and binds event listeners.

    To deregister the current DOM element without setting a new one, pass {@code null}.

    Parameters

    • element: HTMLElement

      The new DOM element.

    Returns void

Generated using TypeDoc