ScreenTapGesture类(Leap:: ScreenTapGesture)
这个类代表了手指或工具的一种点击手势。当手指的顶端向前戳,然后回弹到原来的位置,如同点击一个垂直的屏幕一样,则被识别为屏幕点击手势。在开始点击之前,点击的手指一定要简短的暂停。注意,为了用这个手势,一定要打开使能“开关”,见Gesture类。
屏幕点击手势是离散的,描述点击的ScreenTapGesture对象总是会有停止的状态:STATE_STOP。每个识别了的屏幕点击手势只创建一个ScreenTapGesture对象。
可以用一个连接了的Controller对象的配置属性来设置把一个运动识别为屏幕点击所要求的手指移动和速率的最小值,还要调整检测窗口来估计运动。用以下keys来配置屏幕点击识别:
下面的例子说明了如何配置这些参数,在设置这些参数之前要把Controller对象和Leap Motion的服务/守护进程连接起来。
controller.config().setFloat(“Gesture. ScreenTap.MinForwardVelocity”, 30.0);
controller.config().setFloat(“Gesture. ScreenTap.HistorySeconds”, .5);
controller.config().setFloat(“Gesture. ScreenTap.MinDistance”, 1.0);
controller.config().save();
Vector direction(): 表示手指顶端的运动方向。
用法:Leap::Vector pokeDirection=ScreenTap.direction();
ScreenTapGesture(): 表示构造一个新的ScreenTapGesture对象。没有初始化的Gesture对象被认为是无效的。从Frame对象中得到ScreenTapGesture类的有效的实例。
ScreenTapGesture(const Gesture & rhs): 表示从一个Gesture对象的实例中构造出一个ScreenTapGesture对象。参数rhs是需要特定化的Gesture实例,一定要是ScreenTapGesture对象。
用法:if (gesture.type()==Leap:: ScreenTapGesture:: classType())
ScreenTapGesture =Leap:: ScreenTapGesture(gesture);
Pointable pointable(): 表示实现这个屏幕点击手势的手指。
用法:Leap:: Pointable poker=screentap.pointable();
Vector position(): 表示记录屏幕点击的位置。
用法:Leap::Vector pokePosition=screentap.position();
float progress(): 对于屏幕点击手势,这个值始终为1.
Type classType(): 表示屏幕点击手势的类别。返回TYPE_SCREEN_TAP。