aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--js/slide-deck.js35
1 files changed, 21 insertions, 14 deletions
diff --git a/js/slide-deck.js b/js/slide-deck.js
index b93cea8..5cdb9c4 100644
--- a/js/slide-deck.js
+++ b/js/slide-deck.js
@@ -223,7 +223,7 @@ SlideDeck.prototype.onBodyKeyDown_ = function(e) {
223 break; 223 break;
224 224
225 case 80: // P 225 case 80: // P
226 // if (this.controller && this.controller.isPresenter) { 226 // if (this.controller && this.controller.isPresenter) {
227 document.body.classList.toggle('with-notes'); 227 document.body.classList.toggle('with-notes');
228 // } else if (this.controller && !this.controller.popup) { 228 // } else if (this.controller && !this.controller.popup) {
229 // document.body.classList.toggle('with-notes'); 229 // document.body.classList.toggle('with-notes');
@@ -427,24 +427,31 @@ SlideDeck.prototype.loadConfig_ = function(config) {
427 }, false); 427 }, false);
428 428
429 require([ 'hammer' ], function(Hammer) { 429 require([ 'hammer' ], function(Hammer) {
430 var hammer = new Hammer(self.container); 430
431 hammer.on('swipe', function(e) { 431 var pressKey = function(keyCode) {
432 var evt = document.createEvent('Event'); 432 var evt = document.createEvent('Event');
433 evt.initEvent('keydown', true, true); 433 evt.initEvent('keydown', true, true);
434 evt.keyCode = keyCode;
435 document.body.dispatchEvent(evt);
436 };
434 437
435 switch (e.gesture.direction) { 438 var hammer = new Hammer(self.container);
436 case 'right':
437 // previous slide
438 evt.keyCode = 37;
439 break;
440 case 'left':
441 // next slide
442 evt.keyCode = 39;
443 break;
444 }
445 439
446 document.dispatchEvent(evt); 440 // previous slide
441 hammer.on('swiperight', function() {
442 pressKey(37);
447 }); 443 });
444
445 // next slide
446 hammer.on('swipeleft', function() {
447 pressKey(39);
448 });
449
450 // fullscreen
451 hammer.on('doubletap', function() {
452 pressKey(70);
453 });
454
448 }); 455 });
449 456
450 } 457 }