(function () {
var controller = new Leap.Controller({enableGestures: true}),
- lastGesture = 0,
config = Reveal.getConfig().leap ||
{
naturalSwipe: true
- },
- now;
+ };
controller.on('frame', function (frame) {
- now = new Date().getTime();
- if( lastGesture === 0 ) {
- lastGesture = now;
- }
-
- if ( (now - lastGesture) > 500 && frame.gestures.length > 0 ) {
+ if ( frame.gestures.length > 0 ) {
var gesture = frame.gestures[0],
x = gesture.direction[0],
y = gesture.direction[1];
} else {
config.naturalSwipe ? Reveal.right() : Reveal.left();
}
-
- lastGesture = now;
} else {
if ( y > 0 ) {
config.naturalSwipe ? Reveal.down() : Reveal.up();
config.naturalSwipe ? Reveal.up() : Reveal.down();
}
}
-
- lastGesture = now;
} else if( frame.hands.length == 2 ) {
if ( y > 0 ) {
Reveal.toggleOverview();
}
-
- lastGesture = now;
}
}
}