#include <Leap.h>
The KeyTapGesture class represents a tapping gesture by a finger or tool.
A key tap gesture is recognized when the tip of a finger rotates down toward the palm and then springs back to approximately the original position, as if tapping. The tapping finger must pause briefly before beginning the tap.
Important: To use key tap gestures in your application, you must enable recognition of the key tap gesture. You can enable recognition with:
Key tap gestures are discrete. The KeyTapGesture object representing a tap always has the state, STATE_STOP. Only one KeyTapGesture object is created for each key tap gesture recognized.
You can set the minimum finger movement and velocity required for a movement to be recognized as a key tap as well as adjust the detection window for evaluating the movement using the config attribute of a connected Controller object. Use the following configuration keys to configure key tap recognition:
Key string | Value type | Default value | Units |
---|---|---|---|
Gesture.KeyTap.MinDownVelocity | float | 50 | mm/s |
Gesture.KeyTap.HistorySeconds | float | 0.1 | s |
Gesture.KeyTap.MinDistance | float | 5.0 | mm |
The following example demonstrates how to set the key tap configuration parameters:
Public Member Functions | |
LEAP_EXPORT | KeyTapGesture () |
LEAP_EXPORT | KeyTapGesture (const Gesture &rhs) |
LEAP_EXPORT Vector | position () const |
LEAP_EXPORT Vector | direction () const |
LEAP_EXPORT float | progress () 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::KeyTapGesture::KeyTapGesture | ( | ) |
Constructs a new KeyTapGesture object.
An uninitialized KeyTapGesture object is considered invalid. Get valid instances of the KeyTapGesture class from a Frame object.
LEAP_EXPORT Leap::KeyTapGesture::KeyTapGesture | ( | const Gesture & | rhs | ) |
Constructs a KeyTapGesture object from an instance of the Gesture class.
rhs | The Gesture instance to specialize. This Gesture instance must be a KeyTapGesture object. |
|
inlinestatic |
The key tap gesture type.
LEAP_EXPORT Vector Leap::KeyTapGesture::direction | ( | ) | const |
The direction of finger tip motion.
LEAP_EXPORT Pointable Leap::KeyTapGesture::pointable | ( | ) | const |
LEAP_EXPORT Vector Leap::KeyTapGesture::position | ( | ) | const |
LEAP_EXPORT float Leap::KeyTapGesture::progress | ( | ) | const |
The progress value is always 1.0 for a key tap gesture.