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
|
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
-
eventData :object
-
An event data object to handle all the event tracking/dispatching
Type:
- object
-
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:
- Array.<interaction.InteractionData>
-
last :number
-
Type:
- number
-
mouse :interaction.InteractionData
-
The mouse data
Type:
-
onMouseDown :function
-
Type:
- function
-
onMouseMove :function
-
Type:
- function
-
onMouseOut :function
-
Type:
- function
-
onMouseUp :function
-
Type:
- function
-
onTouchEnd :function
-
Type:
- function
-
onTouchMove :function
-
Type:
- function
-
onTouchStart :function
-
Type:
- function
-
renderer :SystemRenderer
-
The renderer this interaction manager works for.
Type:
-
resolution :number
-
The current resolution
Type:
- number
Methods
-
destroy()
-
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.Parameters:
Name Type Description pointVector the point that the result will be stored in
xnumber the x coord of the position to map
ynumber the y coord of the position to map
-
onTouchEnd(event)
-
Is called when a touch ends on the renderer element
Parameters:
Name Type Description eventEvent The DOM event of a touch ending on the renderer view
-
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 pointVector the point that is tested for collision
displayObjectNode the displayObject that will be hit test (recurcsivly crawls its children)
funcfunction the function that will be called on each interactive object. The displayObject and hit will be passed to the function
hitTestboolean this indicates if the objects inside should be hit test against the point
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 deltaTimenumber