Class cc.TouchDispatcher

Class Summary
Constructor Attributes Constructor Name and Description
 
cc.TouchDispatcher.

Method Summary

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

  • {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
  • 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