Рефакторинг

This commit is contained in:
Book Pauk
2019-02-08 19:40:52 +07:00
parent ca52394ba3
commit c3ebb1b09e
2 changed files with 13 additions and 10 deletions

View File

@@ -39,6 +39,8 @@ import {sleep} from '../../../share/utils';
import bookManager from '../share/bookManager';
import DrawHelper from './DrawHelper';
import rstore from '../../../store/modules/reader';
import clickMap from '../share/clickMap';
const minLayoutWidth = 100;
export default @Component({
@@ -329,7 +331,7 @@ class TextPage extends Vue {
this.searching = false;
this.statusBarMessage = '';
this.getSettings();
this.calcDrawProps();
this.draw();// пока не загрузили, очистим канвас
@@ -1054,21 +1056,15 @@ class TextPage extends Vue {
}
handleClick(pointX, pointY) {
const mouseLegend = {
40: {30: 'PgUp', 100: 'PgDown'},
60: {40: 'Up', 60: 'Menu', 100: 'Down'},
100: {30: 'PgUp', 100: 'PgDown'}
};
const w = pointX/this.realWidth*100;
const h = pointY/this.realHeight*100;
let action = '';
loops: {
for (const x in mouseLegend) {
for (const y in mouseLegend[x]) {
for (const x in clickMap) {
for (const y in clickMap[x]) {
if (w < x && h < y) {
action = mouseLegend[x][y];
action = clickMap[x][y];
break loops;
}
}

View File

@@ -0,0 +1,7 @@
const clickMap = {
40: {30: 'PgUp', 100: 'PgDown'},
60: {40: 'Up', 60: 'Menu', 100: 'Down'},
100: {30: 'PgUp', 100: 'PgDown'}
};
export default clickMap;