#include <Leap.h>
The SwipeGesture class represents a swiping motion of a finger or tool.
Important: To use swipe gestures in your application, you must enable recognition of the swipe gesture. You can enable recognition with:
Swipe gestures are continuous.
You can set the minimum length and velocity required for a movement to be recognized as a swipe using the config attribute of a connected Controller object. Use the following keys to configure swipe recognition:
Key string | Value type | Default value | Units |
---|---|---|---|
Gesture.Swipe.MinLength | float | 150 | mm |
Gesture.Swipe.MinVelocity | float | 1000 | mm/s |
The following example demonstrates how to set the swipe configuration parameters:
Public Member Functions | |
LEAP_EXPORT | SwipeGesture () |
LEAP_EXPORT | SwipeGesture (const Gesture &rhs) |
LEAP_EXPORT Vector | startPosition () const |
LEAP_EXPORT Vector | position () const |
LEAP_EXPORT Vector | direction () const |
LEAP_EXPORT float | speed () const |
LEAP_EXPORT Pointable | pointable () const |
![]() | |
Gesture (GestureImplementation *) | |
LEAP_EXPORT | Gesture () |
LEAP_EXPORT | Gesture (const Gesture &rhs) |
LEAP_EXPORT Type | type () const |
LEAP_EXPORT State | state () const |
LEAP_EXPORT int32_t | id () const |
LEAP_EXPORT int64_t | duration () const |
LEAP_EXPORT float | durationSeconds () const |
LEAP_EXPORT Frame | frame () const |
LEAP_EXPORT HandList | hands () const |
LEAP_EXPORT PointableList | pointables () const |
LEAP_EXPORT bool | isValid () const |
LEAP_EXPORT bool | operator== (const Gesture &rhs) const |
LEAP_EXPORT bool | operator!= (const Gesture &rhs) const |
LEAP_EXPORT std::string | toString () const |
Static Public Member Functions | |
static Type | classType () |
![]() | |
static LEAP_EXPORT const Gesture & | invalid () |
Additional Inherited Members | |
![]() | |
class SharedObject * | m_object |
![]() | |
LEAP_EXPORT | Interface (void *owner) |
LEAP_EXPORT | Interface (Implementation *reference, void *owner) |
LEAP_EXPORT | Interface (const Interface &rhs) |
LEAP_EXPORT Interface & | operator= (const Interface &rhs) |
virtual LEAP_EXPORT | ~Interface () |
template<typename T > | |
T * | get () const |
LEAP_EXPORT Leap::SwipeGesture::SwipeGesture | ( | ) |
LEAP_EXPORT Leap::SwipeGesture::SwipeGesture | ( | const Gesture & | rhs | ) |
Constructs a SwipeGesture object from an instance of the Gesture class.
rhs | The Gesture instance to specialize. This Gesture instance must be a SwipeGesture object. |
|
inlinestatic |
The swipe gesture type.
LEAP_EXPORT Vector Leap::SwipeGesture::direction | ( | ) | const |
The unit direction vector parallel to the swipe motion.
You can compare the components of the vector to classify the swipe as appropriate for your application. For example, if you are using swipes for two dimensional scrolling, you can compare the x and y values to determine if the swipe is primarily horizontal or vertical.
LEAP_EXPORT Pointable Leap::SwipeGesture::pointable | ( | ) | const |
LEAP_EXPORT Vector Leap::SwipeGesture::position | ( | ) | const |
LEAP_EXPORT float Leap::SwipeGesture::speed | ( | ) | const |
The swipe speed in mm/second.