Class: InteractionManager

InteractionManager


new InteractionManager(renderer [, options])

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

Parameters:
Name Type Argument Description
renderer CanvasRenderer | WebGLRenderer

A reference to the current renderer

options object <optional>
Properties
Name Type Argument Default Description
autoPreventDefault boolean <optional>
true

Should the manager automatically prevent default browser actions.

interactionFrequency number <optional>
10

Frequency increases the interaction events will be checked.

Source:

Members


autoPreventDefault :boolean

Should default browser actions automatically be prevented.

Type:
  • boolean
Default Value:
  • true
Source:

currentCursorStyle :string

The css style of the cursor that is being used

Type:
  • string
Source:

eventData :object

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

Type:
  • object
Source:

interactionFrequency :number

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

Type:
  • number
Default Value:
  • 10
Source:

interactiveDataPool :Array.<interaction.InteractionData>

Tiny little interactiveData pool!

Type:
Source:

last :number

Type:
  • number
Source:

mouse :interaction.InteractionData

The mouse data

Type:
Source:

onMouseDown :function

Type:
  • function
Source:

onMouseMove :function

Type:
  • function
Source:

onMouseOut :function

Type:
  • function
Source:

onMouseUp :function

Type:
  • function
Source:

onTouchEnd :function

Type:
  • function
Source:

onTouchMove :function

Type:
  • function
Source:

onTouchStart :function

Type:
  • function
Source:

renderer :SystemRenderer

The renderer this interaction manager works for.

Type:
Source:

resolution :number

The current resolution

Type:
  • number
Source:

Methods


destroy()

Destroys the interaction manager

Source:

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.

Parameters:
Name Type Description
point Vector

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

Source:

onTouchEnd(event)

Is called when a touch ends on the renderer element

Parameters:
Name Type Description
event Event

The DOM event of a touch ending on the renderer view

Source:

processInteractive(point, displayObject, func, hitTest)

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.

Parameters:
Name Type Description
point Vector

the point that is tested for collision

displayObject Node

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

Source:
Returns:

returns true if the displayObject hit the point

Type
boolean

update(deltaTime)

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

Parameters:
Name Type Description
deltaTime number
Source: