pixi.interaction.InteractionManager

type
class
extends
EventEmitter
subclasses
pixi.core.display.DisplayObject
metadata
:native
"PIXI.interaction.InteractionManager"

Constructor

parameters
renderer {CanvasRenderer|WebGLRenderer} A reference to the current renderer
[options] {object}
[options.autoPreventDefault=true] {boolean} Should the manager automatically prevent default browser actions.
[options.interactionFrequency=10] {number} Frequency increases the interaction events will be checked.
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.

Instance Variables hide inherited show inherited

autoPreventDefault : Bool

Should default browser actions automatically be prevented.

click : EventTarget -> Void

currentCursorStyle : String

The css style of the cursor that is being used

eventData : EventTarget

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

interactionFrequency : Int

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

interactiveDataPool : Array<InteractionData>

Tiny little interactiveData pool !

last : Int

mouse : InteractionData

The mouse data

onMouseDown : EventTarget -> Void

onMouseMove : EventTarget -> Void

onMouseOut : EventTarget -> Void

onMouseUp : EventTarget -> Void

onTouchEnd : EventTarget -> Void

onTouchMove : EventTarget -> Void

onTouchStart : EventTarget -> Void

The renderer this interaction manager works for.

tap : EventTarget -> Void

Instance Methods hide inherited show inherited

addListener(event : String, fn : EventTarget -> Void, ?context : Dynamic) : Void

parameters
{String} event Name of the event.
{function} fn Callback function.
{Mixed} context The context of the function.
Register a new EventListener for the given event.

emit(event : String, ?a1 : Dynamic, ?a2 : Dynamic, ?a3 : Dynamic, ?a4 : Dynamic, ?a5 : Dynamic) : Bool

parameters
eventName {String} The name of the event.
returns
{Bool} Indication if we've emitted an event.
Emit an event to all registered event listeners.

listeners(event : String) : Array<Dynamic>

parameters
{String} eventName
returns
{Array}
Return a list of assigned event listeners.

mapPositionToPoint(point : pixi.core.math.Point, x : Float, y : Float) : Void

parameters
{Point} point the point that the result will be stored in
{Float} x the x coord of the position to map
{Float} y the y coord of the position to map
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.

off(event : String, fn : EventTarget -> Void, ?once : Bool) : Void

parameters
{String} event The event we want to remove.
{function} fn The listener that we need to find.
{Bool} once Only remove once listeners.
Remove event listeners.

on(event : String, fn : EventTarget -> Void, ?context : Dynamic) : Void

parameters
{String} event Name of the event.
{function} fn Callback function.
{Mixed} context The context of the function.
Register a new EventListener for the given event.

once(event : String, fn : EventTarget -> Void, ?context : Dynamic) : Void

parameters
{String} event Name of the event.
{function} fn Callback function.
{Mixed} context The context of the function.
Add an EventListener that's only called once.

processInteractive(point : pixi.core.math.Point, displayObject : pixi.core.display.DisplayObject, func : Void -> Void, hitTest : Bool, interactive : Bool) : Bool

parameters
{Point} point the point that is tested for collision
{Container|Sprite|TilingSprite} displayObject the displayObject that will be hit test (recurcsivly crawls its children)
{function} func the function that will be called on each interactive object. The displayObject and hit will be passed to the function
{Bool} hitTest this indicates if the objects inside should be hit test against the point
returns
{Bool} returns true if the displayObject hit the point
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.

removeAllListeners(?event : String) : Void

parameters
{String} event The event want to remove all listeners for.
Remove all listeners or only the listeners for the specified event.

removeListener(event : String, fn : EventTarget -> Void, ?once : Bool) : Void

parameters
{String} event The event we want to remove.
{function} fn The listener that we need to find.
{Bool} once Only remove once listeners.
Remove event listeners.