Добавил реакцию Up-Down

This commit is contained in:
Book Pauk
2019-01-17 02:09:16 +07:00
parent ac09455512
commit 701dfd5496

View File

@@ -87,7 +87,7 @@ class TextPage extends Vue {
this.fontName = 'arial'; this.fontName = 'arial';
this.lineInterval = 5;// px, межстрочный интервал this.lineInterval = 5;// px, межстрочный интервал
this.textAlignJustify = true;// выравнивание по ширине this.textAlignJustify = true;// выравнивание по ширине
this.p = 30;// px, отступ параграфа this.p = 60;// px, отступ параграфа
this.indent = 20;// px, отступ всего текста слева и справа this.indent = 20;// px, отступ всего текста слева и справа
this.wordWrap = true; this.wordWrap = true;
@@ -199,6 +199,18 @@ class TextPage extends Vue {
this.linesDown = lines; this.linesDown = lines;
} }
doDown() {
if (this.linesDown && this.linesDown.length > 1) {
this.bookPos = this.linesDown[1].begin;
}
}
doUp() {
if (this.linesUp && this.linesUp.length > 1) {
this.bookPos = this.linesUp[1].begin;
}
}
doPageDown() { doPageDown() {
if (this.linesDown) { if (this.linesDown) {
let i = this.pageLineCount; let i = this.pageLineCount;
@@ -234,6 +246,12 @@ class TextPage extends Vue {
keyHook(event) { keyHook(event) {
if (event.type == 'keydown') { if (event.type == 'keydown') {
switch (event.key) { switch (event.key) {
case 'ArrowDown':
this.doDown();
break;
case 'ArrowUp':
this.doUp();
break;
case 'PageDown': case 'PageDown':
this.doPageDown(); this.doPageDown();
break; break;