From 32865b43f8fd9cbf00733c59f171c11c39d8c93c Mon Sep 17 00:00:00 2001 From: Rory Hardy Date: Mon, 5 Aug 2013 22:49:39 -0500 Subject: [PATCH] Put the timing code back in. Occasionally gestures were fired twice. This helps prevent that. modified: plugin/leap/leap.js --- plugin/leap/leap.js | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/plugin/leap/leap.js b/plugin/leap/leap.js index ac1c26e7..62a30fcf 100644 --- a/plugin/leap/leap.js +++ b/plugin/leap/leap.js @@ -25,12 +25,14 @@ var b=right.criteria;if(a!==b){if(a>b||a===void 0)return 1;if(ab||a===void 0)return 1;if(ab||a===void 0)return 1;if(a 0 ) { + if ( (now - lastGesture) > 500 && frame.gestures.length > 0 ) { var gesture = frame.gestures[0]; // One hand gestures if( frame.hands.length === 1 ) { // Swipe gestures. 2+ fingers. - if ( frame.fingers.length > 1 && gesture.speed > 1000 && gesture.state === 'start' && gesture.type === 'swipe' ) { + if ( frame.fingers.length > 1 && gesture.speed > 1000 && gesture.type === 'swipe' ) { var x = gesture.direction[0], y = gesture.direction[1]; @@ -90,6 +98,8 @@ var b=right.criteria;if(a!==b){if(a>b||a===void 0)return 1;if(a 0 ) { @@ -97,6 +107,8 @@ var b=right.criteria;if(a!==b){if(a>b||a===void 0)return 1;if(ab||a===void 0)return 1;if(a 0 ) { Reveal.toggleOverview(); } + + lastGesture = now; } } });