Browse Source

Рефакторинг

Book Pauk 5 years ago
parent
commit
9f4c0479ce
2 changed files with 41 additions and 45 deletions
  1. 41 0
      client/components/Reader/Reader.vue
  2. 0 45
      client/components/Reader/TextPage/TextPage.vue

+ 41 - 0
client/components/Reader/Reader.vue

@@ -1126,6 +1126,47 @@ class Reader extends Vue {
                 break;
                 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) {
         if (result && event) {
             event.preventDefault();
             event.preventDefault();
             event.stopPropagation();
             event.stopPropagation();

+ 0 - 45
client/components/Reader/TextPage/TextPage.vue

@@ -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) {
     async startClickRepeat(pointX, pointY) {
         this.repX = pointX;
         this.repX = pointX;
         this.repY = pointY;
         this.repY = pointY;