From: sun16 Date: Sun, 4 Aug 2013 03:36:11 +0000 (-0500) Subject: Added gestures X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=af5acd1aa2735833ec9f0104f1c16f97641f894c;p=reveal.js.git Added gestures Left, right, up, and down gestures. Optional invert for gestures. --- diff --git a/plugin/leap/leap.js b/plugin/leap/leap.js index ee88242..3af73ce 100644 --- a/plugin/leap/leap.js +++ b/plugin/leap/leap.js @@ -20,4 +20,35 @@ var b=right.criteria;if(a!==b){if(a>b||a===void 0)return 1;if(a 0) { + var gesture = frame.gestures[0]; + //console.log(gesture); + var x = gesture.direction[0]; + var y = gesture.direction[1]; + if (gesture.state === 'start' && gesture.type === 'swipe') { + if (Math.abs(x) > Math.abs(y)) { + if (x > 0) { + config.invert ? Reveal.left() : Reveal.right(); + } else { + config.invert ? Reveal.right() : Reveal.left(); + } + } else { + if (y > 0) { + config.invert ? Reveal.down() : Reveal.up(); + } else { + config.invert ? Reveal.up() : Reveal.down(); + } + } + } + } + }); + controller.connect(); +})();