From: Rory Hardy Date: Tue, 6 Aug 2013 03:49:39 +0000 (-0500) Subject: Put the timing code back in. X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=32865b43f8fd9cbf00733c59f171c11c39d8c93c;p=reveal.js.git Put the timing code back in. Occasionally gestures were fired twice. This helps prevent that. modified: plugin/leap/leap.js --- diff --git a/plugin/leap/leap.js b/plugin/leap/leap.js index ac1c26e..62a30fc 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; } } });