PolyK.InteractionManager Class
The interaction manager deals with mouse and touch events. Any DisplayObject can be interactive This manager also supports multitouch.
Constructor
Item Index
Methods
Methods
collectInteractiveSprite
-
displayObject -
iParent
Collects an interactive sprite recursively to have their interactions managed
Parameters:
-
displayObjectDisplayObjectthe displayObject to collect
-
iParentDisplayObject
hitTest
-
item -
interactionData
Tests if the current mouse coords hit a sprite
Parameters:
-
itemDisplayObjectThe displayObject to test for a hit
-
interactionDataInteractionDataThe interactionData object to update in the case of a hit
onMouseDown
-
event
Is called when the mouse button is pressed down on the renderer element
Parameters:
-
eventEventThe DOM event of a mouse button being pressed down
onMouseMove
-
event
Is called when the mouse moves across the renderer element
Parameters:
-
eventEventThe DOM event of the mouse moving
onMouseUp
-
event
Is called when the mouse button is released on the renderer element
Parameters:
-
eventEventThe DOM event of a mouse button being released
onTouchEnd
-
event
Is called when a touch is ended on the renderer element
Parameters:
-
eventEventThe DOM event of a touch ending on the renderer view
onTouchMove
-
event
Is called when a touch is moved across the renderer element
Parameters:
-
eventEventThe DOM event of a touch moving across the renderer view
onTouchStart
-
event
Is called when a touch is started on the renderer element
Parameters:
-
eventEventThe DOM event of a touch starting on the renderer view
setTarget
-
target
Sets the target for event delegation
Parameters:
-
targetWebGLRenderer | CanvasRendererthe renderer to bind events to
setTargetDomElement
-
domElement
Sets the dom element which will receive mouse/touch events. This is useful for when you have other DOM elements ontop of the renderers Canvas element. With this you'll be able to delegate another dom element to receive those events
Parameters:
-
domElementDOMElementthe dom element which will receive mouse and touch events
update
()
private
updates the state of interactive objects
Properties
mouse
InteractionData
the mouse data
touchs
Object
an object that stores current touches (InteractionData) by id reference
