Class: InteractionManager

PIXI.interaction. InteractionManager

new PIXI.interaction.InteractionManager(renderer, options)

The interaction manager deals with mouse and touch events. Any DisplayObject can be interactive
if its interactive parameter is set to true
This manager also supports multitouch.

Name Type Description
renderer PIXI.CanvasRenderer | PIXI.WebGLRenderer

A reference to the current renderer

options object optional
Name Type Default Description
autoPreventDefault boolean true optional

Should the manager automatically prevent default browser actions.

interactionFrequency number 10 optional

Frequency increases the interaction events will be checked.

Members

autoPreventDefaultboolean

Should default browser actions automatically be prevented.

Default Value:
  • true

currentCursorStylestring

The css style of the cursor that is being used

eventDataobject

An event data object to handle all the event tracking/dispatching

interactionFrequencynumber

As this frequency increases the interaction events will be checked more often.

Default Value:
  • 10

interactiveDataPoolArray.<PIXI.interaction.InteractionData>

Tiny little interactiveData pool !

lastnumber

The mouse data

onMouseDownfunction

onMouseMovefunction

onMouseOutfunction

onMouseUpfunction

onTouchEndfunction

onTouchMovefunction

onTouchStartfunction

The renderer this interaction manager works for.

resolutionnumber

The current resolution

Methods

Destroys the interaction manager

mapPositionToPoint(point, x, y)

Maps x and y coords from a DOM object and maps them correctly to the pixi 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.

Name Type Description
point PIXI.Point

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

Is called when a touch ends on the renderer element

Name Type Description
event Event

The DOM event of a touch ending on the renderer view

processInteractive(point, displayObject, func, hitTest){boolean}

This function is provides a neat way of crawling through the scene graph and running a specified function on all interactive objects it finds.
It will also take care of hit testing the interactive objects and passes the hit across in the function.

Name Type Description
point PIXI.Point

the point that is tested for collision

displayObject PIXI.Container | PIXI.Sprite | PIXI.extras.TilingSprite

the displayObject that will be hit test (recurcsivly crawls its children)

func function

the function that will be called on each interactive object. The displayObject and hit will be passed to the function

hitTest boolean

this indicates if the objects inside should be hit test against the point

Returns:
Type Description
boolean returns true if the displayObject hit the point

Updates the state of interactive objects.
Invoked by a throttled ticker update from
PIXI.ticker.shared.

Name Type Description
deltaTime number