Browse Source

Handle keycodes (left/right/space) to navigate the presentation.

pull/70/head
Joachim Bauch 11 years ago
parent
commit
fcc9c94137
  1. 12
      static/js/directives/pdfcanvas.js
  2. 25
      static/js/directives/presentation.js

12
static/js/directives/pdfcanvas.js

@ -215,12 +215,20 @@ define(['require', 'underscore', 'jquery', 'pdf'], function(require, _, $, pdf) @@ -215,12 +215,20 @@ define(['require', 'underscore', 'jquery', 'pdf'], function(require, _, $, pdf)
pdfCanvas.redrawPage();
});
$scope.prevPage = function() {
$scope.$on("prevPage", function() {
pdfCanvas.prevPage();
});
$scope.$on("nextPage", function() {
pdfCanvas.nextPage();
});
$scope.prevPage = function() {
$scope.$emit("prevPage");
};
$scope.nextPage = function() {
pdfCanvas.nextPage();
$scope.$emit("nextPage");
};
}];

25
static/js/directives/presentation.js

@ -367,6 +367,31 @@ define(['jquery', 'underscore', 'text!partials/presentation.html'], function($, @@ -367,6 +367,31 @@ define(['jquery', 'underscore', 'text!partials/presentation.html'], function($,
mediaStream.webrtc.e.off("statechange", updater);
};
$(document).on("keyup", function(event) {
if (!$scope.layout.presentation) {
return;
}
if ($(event.target).is("input,textarea,select")) {
return;
}
$scope.$apply(function() {
switch (event.keyCode) {
case 37:
// left arrow
$scope.$emit("prevPage");
event.preventDefault();
break;
case 39:
// right arrow
case 32:
// space
$scope.$emit("nextPage");
event.preventDefault();
break;
}
});
});
$scope.$watch("layout.presentation", function(newval, oldval) {
if (newval && !oldval) {
$scope.showPresentation();

Loading…
Cancel
Save