Class SKGestureDetector
A platform-agnostic gesture recognition engine that detects taps, long presses, pan, pinch, rotation, and fling gestures from touch input.
public sealed class SKGestureDetector : IDisposable
- Inheritance
-
SKGestureDetector
- Implements
- Inherited Members
Remarks
This engine is a pure gesture detector. It processes touch events and raises events when gestures are recognized. It does not maintain transform state or run animations — use SKGestureTracker for that.
The engine must be used on the UI thread. It captures the current SynchronizationContext when processing touch events and uses it to marshal timer callbacks back to the UI thread.
Call Dispose() to clean up resources when done.
Constructors
- SKGestureDetector()
Initializes a new instance of SKGestureDetector with default options.
- SKGestureDetector(SKGestureDetectorOptions)
Initializes a new instance of SKGestureDetector with the specified options.
Properties
- IsEnabled
Gets or sets a value indicating whether the gesture detector is enabled.
- IsGestureActive
Gets a value indicating whether a gesture is currently in progress.
- Options
Gets the configuration options for this detector.
- TimeProvider
Gets or sets the time provider function used to obtain the current time in ticks.
Methods
- Dispose()
Releases all resources used by this SKGestureDetector instance.
- ProcessMouseWheel(SKPoint, float, float)
Processes a mouse wheel (scroll) event.
- ProcessTouchCancel(long)
Processes a touch cancel event.
- ProcessTouchDown(long, SKPoint, bool)
Processes a touch down event.
- ProcessTouchMove(long, SKPoint, bool)
Processes a touch move event.
- ProcessTouchUp(long, SKPoint, bool)
Processes a touch up event.
- Reset()
Resets the gesture detector to its initial state, clearing all active touches and cancelling any pending timers.
Events
- DoubleTapDetected
Occurs when a double tap is detected.
- FlingDetected
Occurs when a fling gesture is detected (fired once with initial velocity upon touch release).
- GestureEnded
Occurs when a touch gesture interaction ends (last finger lifts from the surface).
- GestureStarted
Occurs when a touch gesture interaction begins (first finger touches the surface).
- HoverDetected
Occurs when a mouse hover (move without contact) is detected.
- LongPressDetected
Occurs when a long press is detected.
- PanDetected
Occurs when a single-finger pan (drag) gesture is detected.
- PinchDetected
Occurs when a two-finger pinch (scale) gesture is detected.
- RotateDetected
Occurs when a two-finger rotation gesture is detected.
- ScrollDetected
Occurs when a mouse scroll (wheel) event is detected.
- TapDetected
Occurs when a single tap is detected.