Class Index | File Index

Classes


Class cc.TouchDispatcher


Extends cc.Class.

Defined in: CCTouchDispatcher.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
cc.TouchDispatcher.
Field Summary
Field Attributes Field Name and Description
<static>  
cc.TouchDispatcher.preTouchPoint
Method Summary
Method Attributes Method Name and Description
 
addStandardDelegate(delegate, priority)
Adds a standard touch delegate to the dispatcher's list.
 
addTargetedDelegate(delegate, priority, swallowsTouches)
 
findHandler(array, delegate)
 
forceAddHandler(handler, array)
Force add handler
 
Force remove all delegates
 
 
init()
 
Whether or not the events are going to be dispatched.
 
<static>  
cc.TouchDispatcher.registerHtmlElementEvent(element)
 
Removes all touch delegates, releasing all the delegates
 
removeDelegate(delegate)
Removes a touch delegate.
 
setDispatchEvents(dispatchEvents)
 
setPriority(priority, delegate)
Changes the priority of a previously added delegate.
 
touches(touches, event, index)
 
touchesBegan(touches, event)
 
touchesCancelled(touches, event)
 
touchesEnded(touches, event)
 
touchesMoved(touches, event)
Class Detail
cc.TouchDispatcher()
cc.TouchDispatcher. Singleton that handles all the touch events. The dispatcher dispatches events to the registered TouchHandlers. There are 2 different type of touch handlers: - Standard Touch Handlers - Targeted Touch Handlers The Standard Touch Handlers work like the CocoaTouch touch handler: a set of touches is passed to the delegate. On the other hand, the Targeted Touch Handlers only receive 1 touch at the time, and they can "swallow" touches (avoid the propagation of the event). Firstly, the dispatcher sends the received touches to the targeted touches. These touches can be swallowed by the Targeted Touch Handlers. If there are still remaining touches, then the remaining touches will be sent to the Standard Touch Handlers.
Field Detail
<static> cc.TouchDispatcher.preTouchPoint
Method Detail
addStandardDelegate(delegate, priority)
Adds a standard touch delegate to the dispatcher's list. See StandardTouchDelegate description. IMPORTANT: The delegate will be retained.
Parameters:
{cc.TouchDelegate} delegate
{Number} priority

addTargetedDelegate(delegate, priority, swallowsTouches)
Parameters:
{cc.TouchDelegate} delegate
{Number} priority
{Boolean} swallowsTouches

{cc.TargetedTouchHandler|cc.StandardTouchHandler|Null} findHandler(array, delegate)
Parameters:
{Array||cc.TouchDelegate} array
array or delegate
{cc.TouchDelegate} delegate
Returns:
{cc.TargetedTouchHandler|cc.StandardTouchHandler|Null}

{Array} forceAddHandler(handler, array)
Force add handler
Parameters:
{cc.TouchHandler} handler
{Array} array
Returns:
{Array}

forceRemoveAllDelegates()
Force remove all delegates

forceRemoveDelegate(delegate)
Parameters:
{cc.TouchDelegate} delegate

{Boolean} init()
Returns:
{Boolean}

{Boolean} isDispatchEvents()
Whether or not the events are going to be dispatched. Default: true
Returns:
{Boolean}

rearrangeHandlers(array)
Parameters:
{Array} array

<static> cc.TouchDispatcher.registerHtmlElementEvent(element)
Parameters:
{HTMLCanvasElement|HTMLDivElement} element

removeAllDelegates()
Removes all touch delegates, releasing all the delegates

removeDelegate(delegate)
Removes a touch delegate. The delegate will be released
Parameters:
{cc.TouchDelegate} delegate

setDispatchEvents(dispatchEvents)
Parameters:
{Boolean} dispatchEvents

setPriority(priority, delegate)
Changes the priority of a previously added delegate. The lower the number, the higher the priority
Parameters:
{Number} priority
{cc.TouchDelegate} delegate

touches(touches, event, index)
Parameters:
{Array} touches
{event} event
{Number} index

touchesBegan(touches, event)
Parameters:
{Array} touches
{event} event

touchesCancelled(touches, event)
Parameters:
{Array} touches
{event} event

touchesEnded(touches, event)
Parameters:
{Array} touches
{event} event

touchesMoved(touches, event)
Parameters:
{Array} touches
{event} event

Documentation generated by JsDoc Toolkit 2.4.0 on Wed Jan 09 2013 07:51:54 GMT-0800 (PST)