Рефакторинг

This commit is contained in:
Book Pauk
2020-03-19 17:05:29 +07:00
parent 2c57817dde
commit 9f4c0479ce
2 changed files with 41 additions and 45 deletions

View File

@@ -1126,6 +1126,47 @@ class Reader extends Vue {
break;
}
if (!result && this.activePage == 'TextPage' && this.$refs.page) {
result = true;
const textPage = this.$refs.page;
switch (action) {
case 'bookBegin':
textPage.doHome();
break;
case 'bookEnd':
textPage.doEnd();
break;
case 'pageBack':
textPage.doPageUp();
break;
case 'pageForward':
textPage.doPageDown();
break;
case 'lineBack':
textPage.doUp();
break;
case 'lineForward':
textPage.doDown();
break;
case 'incFontSize':
textPage.doFontSizeInc();
break;
case 'decFontSize':
textPage.doFontSizeDec();
break;
case 'scrollingSpeedUp':
textPage.doScrollingSpeedUp();
break;
case 'scrollingSpeedDown':
textPage.doScrollingSpeedDown();
break;
default:
result = false;
break;
}
}
if (result && event) {
event.preventDefault();
event.stopPropagation();

View File

@@ -940,51 +940,6 @@ class TextPage extends Vue {
}
}
keyHook(event) {
let result = false;
if (event.type == 'keydown' && !event.ctrlKey && !event.altKey) {
result = true;
const action = this.$root.readerActionByKeyEvent(event);
switch (action) {
case 'bookBegin':
this.doHome();
break;
case 'bookEnd':
this.doEnd();
break;
case 'pageBack':
this.doPageUp();
break;
case 'pageForward':
this.doPageDown();
break;
case 'lineBack':
this.doUp();
break;
case 'lineForward':
this.doDown();
break;
case 'incFontSize':
this.doFontSizeInc();
break;
case 'decFontSize':
this.doFontSizeDec();
break;
case 'scrollingSpeedUp':
this.doScrollingSpeedUp();
break;
case 'scrollingSpeedDown':
this.doScrollingSpeedDown();
break;
default:
result = false;
break;
}
}
return result;
}
async startClickRepeat(pointX, pointY) {
this.repX = pointX;
this.repY = pointY;