Click or drag to resize

GestureRecognizer Class

A gesture recognizer allows handling gestures as well as ensuring that different gestures do not execute at the same time. Platform specific code is required to create GestureTouch sets and pass them to the appropriate gesture recognizer(s). Creating extension methods on the DigitalRubyShared.GestureRecognizer class is a good way.
Inheritance Hierarchy
SystemObject
  DigitalRubySharedGestureRecognizer
    More...

Namespace:  DigitalRubyShared
Assembly:  Assembly-CSharp (in Assembly-CSharp.dll) Version: 0.0.0.0
Syntax
C#
public class GestureRecognizer : IDisposable

The GestureRecognizer type exposes the following members.

Constructors
  NameDescription
Public methodGestureRecognizer
Constructor
Top
Properties
  NameDescription
Public propertyAllowSimultaneousExecutionIfPlatformSpecificViewsAreDifferent
Allows simultaneous execution if the platform specific views do no match. Default is true.
Public propertyClearTrackedTouchesOnEndOrFail
Whether tracked touches are cleared when the gesture ends or fails, default is false. By setting to true, you allow the gesture to possibly execute again with a different touch even if the original touch it failed on is still on-going. This is a special case, so be sure to watch for problems if you set this to true, as leaving it false ensures the most correct behavior, especially with lots of gestures at once.
Public propertyCurrentTrackedTouches
The current tracked touches for the gesture
Public propertyCustomData
Custom data for the gesture that you can attach, or just leave null if you don't need this This is useful if you want to retrieve this in a callback function, but it is not require for the gesture to work properly
Public propertyDeltaX
Change in focus x in pixels
Public propertyDeltaY
Change in focus y in pixels
Public propertyDistanceX
The distance (in pixels) the gesture focus has moved from where it started along the x axis
Public propertyDistanceY
The distance (in pixels) the gesture focus has moved from where it started along the y axis
Public propertyEnabled
Whether the gesture is Enabled. Default is true.
Public propertyFocusX
Focus x value in pixels (average of all touches)
Public propertyFocusY
Focus y value in pixels (average of all touches)
Public propertyIsRestarting
True if gesture is in process of restarting, false otherwise
Public propertyMaximumNumberOfTouchesToTrack
The maximum number of touches to track. This gesture will never track more touches than this. Default is usually 1 or 2. Not all gestures will honor values higher than 1.
Public propertyMinimumNumberOfTouchesToTrack
The minimum number of touches to track. This gesture will not start unless this many touches are tracked. Default is usually 1 or 2. Not all gestures will honor values higher than 1.
Public propertyPlatformSpecificView
A platform specific view object that this gesture can execute in, null if none
Public propertyPlatformSpecificViewScale
The platform specific view scale (default is 1.0). Change this if the view this gesture is attached to is being scaled.
Public propertyPressure
Average pressure of all tracked touches
Protected propertyPrevFocusX
Previous focus x
Protected propertyPrevFocusY
Previous focus y
Public propertyReceivedAdditionalTouches
Whether additional touches were added to the gesture since the last execute state.
Public propertyRequireGestureRecognizersToFail
If this gesture reaches the EndPending state and the specified gestures fail, this gestures will end. If the specified gesture begins, executes or ends, then this gesture will immediately fail.
Public propertyRequireGestureRecognizerToFail
Convenience method to add / remove one gesture to require failure on. Set to null to clear all require gestures to fail.
Public propertyResetOnEnd
Whether the gesture should reset when it ends
Public propertySpeed
The speed of the gesture in pixels using focus
Public propertyStartFocusX
Start focus x value in pixels (average of all touches)
Public propertyStartFocusY
Start focus y value in pixels (average of all touches)
Public propertyState
Get the current gesture recognizer state
Public propertyTrackedTouchCountIsWithinRange
Whether the current number of tracked touches is within the min and max number of touches to track
Public propertyVelocityX
Velocity x in pixels using focus
Public propertyVelocityY
Velocity y in pixels using focus
Top
Methods
  NameDescription
Public methodAddRequiredGestureRecognizerToFail
Require a gesture to fail in order for this gesture to end
Public methodAllowSimultaneousExecution
Allows the simultaneous execution with other gesture. This links both gestures so this method only needs to be called once on one of the gestures. Pass null to allow simultaneous execution with all gestures.
Public methodAllowSimultaneousExecutionWithAllGestures
Allows simultaneous execution with all gestures
Protected methodAreTrackedTouchesWithinDistance
Determines whether any tracked touches are within the distance of the starting point of each tracked touch.
Public methodBeginGestureRestart
Allows the gesture to restart even if the touches are not lifted. This is only valid when called from the "Ended" state.
Protected methodCalculateFocus(ICollectionGestureTouch)
Calculate the focus of the gesture
Protected methodCalculateFocus(ICollectionGestureTouch, Boolean)
Calculate the focus of the gesture
Public methodDisallowSimultaneousExecution
Disallows the simultaneous execution with other gesture. This unlinks both gestures so this method only needs to be called once on one of the gestures. By default, gesures are not allowed to execute simultaneously, so you only need to call this method if you previously allowed the gestures to execute simultaneously. Pass null to disallow simulatneous execution with all gestures (i.e. you previously called AllowSimultaneousExecution with a null value.
Public methodDisallowSimultaneousExecutionWithAllGestures
Disallows simultaneous execution with all gestures
Public methodDispose
Dispose of the gesture and ensure it is removed from the global list of active gestures
Public methodDistance(Single)
Get the distance of a length, in units
Public methodDistance(Single, Single)
Gets the distance of a vector, in units
Public methodDistanceBetweenPoints
Gets the distance between two points, in units
Public methodEndGestureRestart
Restart the gesture with a set of begin touches
Public methodEquals (Inherited from Object.)
Protected methodFinalize
Finalizer
(Overrides ObjectFinalize.)
Public methodGetHashCode (Inherited from Object.)
Public methodGetType (Inherited from Object.)
Protected methodIgnoreTouch
Ignore a touch until it is released
Protected methodMemberwiseClone (Inherited from Object.)
Public methodStatic memberNumberOfGesturesInProgress
The global total number of gestures in progress
Public methodPointsAreWithinDistance
Determines whether two points are within a specified distance
Public methodProcessTouchesBegan
Call with the touches that began
Public methodProcessTouchesCancelled
Process cancelled touches
Public methodProcessTouchesEnded
Call with the touches that ended
Public methodProcessTouchesMoved
Call with the touches that moved
Public methodRemoveRequiredGestureRecognizerToFail
Remove a gesture needing to fail in order for this gesture to end
Public methodReset
Reset all internal state for the gesture recognizer
Public methodStatic memberRunActionAfterDelay
Run an action on the main thread after a delay
Protected methodSetState
Sets the state of the gesture. Continous gestures should set the executing state every time they change.
Public methodSimulate
Simulate a gesture
Protected methodStateChanged
Called when state changes
Public methodToString
ToString
(Overrides ObjectToString.)
Protected methodTouchesBegan
Call with the touches that began, child class should override
Protected methodTouchesEnded
Call with the touches that ended, child class should override
Protected methodTouchesMoved
Call with the touches that moved, child class should override
Protected methodTrackCurrentTrackedTouchesStartLocations
Track all touches in CurrentTrackedTouches start locations
Protected methodTrackTouches
Begin tracking the specified touch ids
Top
Events
  NameDescription
Public eventStateUpdated
Fires when state is updated, use this instead of Updated, which has been deprecated. The gesture object has a CurrentTrackedTouches property where you can access the current touches.
Public eventUpdated Obsolete.
Executes when the gesture changes
Top
Fields
  NameDescription
Public fieldStatic memberMainThreadCallback
Main thread callback implementation
Top
Extension Methods
  NameDescription
Public Extension MethodLog
Log
(Defined by GestureLogger.)
Top
See Also
Inheritance Hierarchy