Class: GestureRecognizer

GestureRecognizer(target, callback)

Gesture recognizers translate user input event streams into higher level actions. A gesture recognizer is associated with an event target, which dispatches mouse and keyboard events to the gesture recognizer. When a gesture recognizer has received enough information from the event stream to interpret the action, it calls its callback functions. Callback functions may be specified at construction or added to the gestureCallbacks list after construction.

Constructor

new GestureRecognizer(target, callback)

Constructs a base gesture recognizer. This is an abstract base class and not intended to be instantiated directly.
Parameters:
Name Type Description
target EventTarget The document element this gesture recognizer observes for mouse and touch events.
callback function An optional function to call when this gesture is recognized. If non-null, the function is called when this gesture is recognized, and is passed a single argument: this gesture recognizer, e.g., gestureCallback(recognizer).
Source:
Throws:
If the specified target is null or undefined.
Type
ArgumentError

Members

clientX :Number

Indicates the X coordinate of this gesture.
Type:
  • Number
Source:

clientY :Number

Returns the Y coordinate of this gesture.
Type:
  • Number
Source:

enabled :Boolean

Indicates whether or not this gesture recognizer is enabled. When false, this gesture recognizer will ignore any events dispatched by its target.
Type:
  • Boolean
Default Value:
  • true
Source:

(readonly) gestureCallbacks :Array.<function()>

The list of functions to call when this gesture is recognized. The functions have a single argument: this gesture recognizer, e.g., gestureCallback(recognizer). Applications may add functions to this array or remove them.
Type:
  • Array.<function()>
Source:

(readonly) mouseButtonMask :Number

Indicates the currently pressed mouse buttons as a bitmask. A value of 0 indicates that no buttons are pressed. A nonzero value indicates that one or more buttons are pressed as follows: bit 1 indicates the primary button, bit 2 indicates the the auxiliary button, bit 3 indicates the secondary button.
Type:
  • Number
Source:

state :String

Indicates this gesture's current state. Possible values are WorldWind.POSSIBLE, WorldWind.FAILED, WorldWind.RECOGNIZED, WorldWind.BEGAN, WorldWind.CHANGED, WorldWind.CANCELLED and WorldWind.ENDED.
Type:
  • String
Default Value:
  • WorldWind.POSSIBLE
Source:

(readonly) target :EventTarget

Indicates the document element this gesture recognizer observes for UI events.
Type:
  • EventTarget
Source:

(readonly) touchCount :Number

Indicates the number of active touches.
Type:
  • Number
Source:

translationX :Number

Indicates this gesture's translation along the X axis since the gesture started.
Type:
  • Number
Source:

translationY :Number

Indicates this gesture's translation along the Y axis since the gesture started.
Type:
  • Number
Source:

Methods

addListener(listener)

Registers a gesture state listener on this GestureRecognizer. Registering state listeners using this function enables applications to receive notifications of gesture recognition. Listeners must implement a gestureStateChanged method to receive notifications. The gestureStateChanged method will receive one parameter containing a reference to the recognizer that changed state.
Parameters:
Name Type Description
listener The function to call when the event occurs.
Source:
Throws:
If any argument is null or undefined.
Type
ArgumentError

canRecognizeSimultaneouslyWith(recognizer) → {Boolean}

Parameters:
Name Type Description
recognizer
Source:
Returns:
Type
Boolean

(protected) mouseDown(event)

Parameters:
Name Type Description
event
Source:

(protected) mouseMove(event)

Parameters:
Name Type Description
event
Source:

(protected) mouseUp(event)

Parameters:
Name Type Description
event
Source:

(protected) prepareToRecognize()

Source:

recognizeSimultaneouslyWith(recognizer)

Parameters:
Name Type Description
recognizer
Source:

removeListener(listener)

Removes a gesture state listener from this GestureRecognizer. The listener must be the same object passed to addListener. Calling removeListener with arguments that do not identify a currently registered listener has no effect.
Parameters:
Name Type Description
listener The listener to remove. Must be the same object passed to addListener.
Source:
Throws:
If any argument is null or undefined.
Type
ArgumentError

requiredToFailByRecognizer(recognizer) → {Boolean}

Parameters:
Name Type Description
recognizer
Source:
Returns:
Type
Boolean

requireRecognizerToFail(recognizer)

Parameters:
Name Type Description
recognizer
Source:

requiresRecognizerToFail(recognizer) → {Boolean}

Parameters:
Name Type Description
recognizer
Source:
Returns:
Type
Boolean

(protected) reset()

Source:

touch(index) → {Touch}

Parameters:
Name Type Description
index
Source:
Throws:
If the index is out of range.
Type
ArgumentError
Returns:
Type
Touch

(protected) touchCancel(touch)

Parameters:
Name Type Description
touch
Source:

(protected) touchEnd(touch)

Parameters:
Name Type Description
touch
Source:

(protected) touchMove(touch)

Parameters:
Name Type Description
touch
Source:

(protected) touchStart(touch)

Parameters:
Name Type Description
touch
Source: