1
0
mirror of https://github.com/webslides/WebSlides.git synced 2025-08-16 10:04:45 +02:00

Allowing to navigate with re/av page

Fixes #48
This commit is contained in:
Antonio Laguna
2017-03-01 13:56:11 +01:00
parent 09bdc31b64
commit 8ae6954e5f
2 changed files with 22 additions and 16 deletions

View File

@@ -24,22 +24,26 @@ export default class Keyboard {
onKeyPress_(event) {
let method;
if (event.which === Keys.SPACE) {
method = this.ws_.goNext;
} else {
if (this.ws_.isVertical) {
if (event.which === Keys.DOWN) {
method = this.ws_.goNext;
} else if (event.which === Keys.UP) {
method = this.ws_.goPrev;
}
} else {
if (event.which === Keys.RIGHT) {
method = this.ws_.goNext;
} else if (event.which === Keys.LEFT) {
method = this.ws_.goPrev;
}
}
switch (event.which) {
case Keys.AV_PAGE:
case Keys.SPACE:
method = this.ws_.goNext;
break;
case Keys.RE_PAGE:
method = this.ws_.goPrev;
break;
case Keys.DOWN:
method = this.ws_.isVertical ? this.ws_.goNext : null;
break;
case Keys.UP:
method = this.ws_.isVertical ? this.ws_.goPrev : null;
break;
case Keys.LEFT:
method = !this.ws_.isVertical ? this.ws_.goPrev : null;
break;
case Keys.RIGHT:
method = !this.ws_.isVertical ? this.ws_.goNext : null;
break;
}
if (method) {

View File

@@ -1,6 +1,8 @@
const Keys = {
ENTER: 13,
SPACE: 32,
RE_PAGE: 33,
AV_PAGE: 34,
LEFT: 37,
UP: 38,
RIGHT: 39,