Permalink
Browse files

new gesture for landing

  • Loading branch information...
1 parent 3b7e5f6 commit f39921f07b1042b3f4cc14b05cec21d199369864 @jsjohnst jsjohnst committed Sep 29, 2013
Showing with 17 additions and 6 deletions.
  1. +17 −6 js/leapcopter.js
View
@@ -104,14 +104,25 @@ function handleCircle(event, gesture) {
var controllerOptions = {enableGestures: true};
+var lotsoffingers = false;
+
Leap.loop(controllerOptions, function(event) {
- if (event.hands.length == 2 && event.gestures.length == 2) {
- var hand1 = detectMovement(event.gestures[0]);
- var hand2 = detectMovement(event.gestures[1]);
+ if (event.hands.length == 2) {
+ if(event.gestures.length == 2) {
+ var hand1 = detectMovement(event.gestures[0]);
+ var hand2 = detectMovement(event.gestures[1]);
+
+ if(hand1 == "up" && hand2 == "up") {
+ return gestureRecognized("multi", "up");
+ }
+ }
- if(hand1 == "up" && hand2 == "up") {
- return gestureRecognized("multi", "up");
- } else if(hand1 == "down" && hand2 == "down") {
+ if(event.pointables.length >= 6) {
+ lotsoffingers = true;
+ setTimeout(function() { lotsoffingers = false; }, 2000);
+ }
+
+ if(lotsoffingers && event.pointables.length <= 2) {
return gestureRecognized("multi", "down");
}
}

0 comments on commit f39921f

Please sign in to comment.