PIXI.EventSystem

class EventSystem

The system for handling UI events.

Constructor


new PIXI.EventSystem(renderer: PIXI.Renderer) → {}
Parameters:
Name Type Description
renderer PIXI.Renderer

Summary


Properties from EventSystem

boolean
autoPreventDefault = true
unknown
cursorStyles
HTMLElement
domElement
PIXI.Renderer
renderer

The renderer managing this EventSystem.

number
resolution = 1

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

PIXI.EventBoundary
rootBoundary

The PIXI.EventBoundary for the stage.

supportsPointerEvents = --

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

supportsTouchEvents

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

Methods from EventSystem

void
destroy()

Destroys all event listeners and detaches the renderer.

void
mapPositionToPoint(point: PIXI.IPointData, x: number, y: number)
void
setCursor(mode: string)
void
setTargetElement(element: HTMLElement)

Sets the domElement and binds event listeners.

PIXI.FederatedWheelEvent
protected normalizeWheelEvent(nativeEvent: WheelEvent)

Normalizes the native WheelEvent.

void
protected onWheel(nativeEvent: WheelEvent)

Public Properties


autoPreventDefault EventSystem.ts:51
autoPreventDefault: boolean = true

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.

cursorStyles EventSystem.ts:60
cursorStyles: unknown

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

domElement EventSystem.ts:69
domElement: HTMLElement

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

renderer EventSystem.ts:78
renderer: PIXI.Renderer

The renderer managing this EventSystem.

resolution EventSystem.ts:75
resolution: number = 1

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

rootBoundary EventSystem.ts:33
rootBoundary: PIXI.EventBoundary

The PIXI.EventBoundary for the stage.

The 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 EventSystem.ts:48
supportsPointerEvents = --

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

supportsTouchEvents EventSystem.ts:45
supportsTouchEvents

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

Public Methods


destroy EventSystem.ts:121
destroy() → {void}

Destroys all event listeners and detaches the renderer.

Returns:
Type Description
void
mapPositionToPoint EventSystem.ts:448
mapPositionToPoint(point: PIXI.IPointData, x: number, y: number) → {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:
Name Type Description
point PIXI.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:
Type Description
void
setCursor EventSystem.ts:128
setCursor(mode: string) → {void}

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

Parameters:
Name Type Description
mode string

cursor mode, a key from the cursorStyles dictionary

Returns:
Type Description
void
setTargetElement EventSystem.ts:319
setTargetElement(element: HTMLElement) → {void}

Sets the domElement and binds event listeners.

To deregister the current DOM element without setting a new one, pass null.

Parameters:
Name Type Description
element HTMLElement

The new DOM element.

Returns:
Type Description
void

Protected Methods


normalizeWheelEvent EventSystem.ts:558
protected normalizeWheelEvent(nativeEvent: WheelEvent) → {PIXI.FederatedWheelEvent}

Normalizes the native WheelEvent.

The returned PIXI.FederatedWheelEvent is a shared instance. It will not persist across multiple native wheel events.

Parameters:
Name Type Description
nativeEvent WheelEvent

The native wheel event that occurred on the canvas.

Returns:
Type Description
PIXI.FederatedWheelEvent

A federated wheel event.

onWheel EventSystem.ts:307
protected onWheel(nativeEvent: WheelEvent) → {void}

Passive handler for wheel events on this.domElement.

Parameters:
Name Type Description
nativeEvent WheelEvent

The native wheel event.

Returns:
Type Description
void

Powered by webdoc!