1
0
mirror of https://github.com/webslides/WebSlides.git synced 2025-08-24 21:56:12 +02:00

Allowing navigation with Home and End keys

Fixes #49
This commit is contained in:
Antonio Laguna
2017-03-02 09:41:59 +01:00
parent 8ae6954e5f
commit 440e1bf37e
2 changed files with 12 additions and 1 deletions

View File

@@ -23,6 +23,7 @@ export default class Keyboard {
*/
onKeyPress_(event) {
let method;
let argument;
switch (event.which) {
case Keys.AV_PAGE:
@@ -32,6 +33,14 @@ export default class Keyboard {
case Keys.RE_PAGE:
method = this.ws_.goPrev;
break;
case Keys.HOME:
method = this.ws_.goToSlide;
argument = 0;
break;
case Keys.END:
method = this.ws_.goToSlide;
argument = this.ws_.maxSlide_ - 1;
break;
case Keys.DOWN:
method = this.ws_.isVertical ? this.ws_.goNext : null;
break;
@@ -47,7 +56,7 @@ export default class Keyboard {
}
if (method) {
method.call(this.ws_);
method.call(this.ws_, argument);
}
}
}

View File

@@ -3,6 +3,8 @@ const Keys = {
SPACE: 32,
RE_PAGE: 33,
AV_PAGE: 34,
END: 35,
HOME: 36,
LEFT: 37,
UP: 38,
RIGHT: 39,