Рефакторинг
This commit is contained in:
@@ -39,6 +39,8 @@ import {sleep} from '../../../share/utils';
|
|||||||
import bookManager from '../share/bookManager';
|
import bookManager from '../share/bookManager';
|
||||||
import DrawHelper from './DrawHelper';
|
import DrawHelper from './DrawHelper';
|
||||||
import rstore from '../../../store/modules/reader';
|
import rstore from '../../../store/modules/reader';
|
||||||
|
import clickMap from '../share/clickMap';
|
||||||
|
|
||||||
const minLayoutWidth = 100;
|
const minLayoutWidth = 100;
|
||||||
|
|
||||||
export default @Component({
|
export default @Component({
|
||||||
@@ -329,7 +331,7 @@ class TextPage extends Vue {
|
|||||||
this.searching = false;
|
this.searching = false;
|
||||||
|
|
||||||
this.statusBarMessage = '';
|
this.statusBarMessage = '';
|
||||||
|
|
||||||
this.getSettings();
|
this.getSettings();
|
||||||
this.calcDrawProps();
|
this.calcDrawProps();
|
||||||
this.draw();// пока не загрузили, очистим канвас
|
this.draw();// пока не загрузили, очистим канвас
|
||||||
@@ -1054,21 +1056,15 @@ class TextPage extends Vue {
|
|||||||
}
|
}
|
||||||
|
|
||||||
handleClick(pointX, pointY) {
|
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 w = pointX/this.realWidth*100;
|
||||||
const h = pointY/this.realHeight*100;
|
const h = pointY/this.realHeight*100;
|
||||||
|
|
||||||
let action = '';
|
let action = '';
|
||||||
loops: {
|
loops: {
|
||||||
for (const x in mouseLegend) {
|
for (const x in clickMap) {
|
||||||
for (const y in mouseLegend[x]) {
|
for (const y in clickMap[x]) {
|
||||||
if (w < x && h < y) {
|
if (w < x && h < y) {
|
||||||
action = mouseLegend[x][y];
|
action = clickMap[x][y];
|
||||||
break loops;
|
break loops;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
7
client/components/Reader/share/clickMap.js
Normal file
7
client/components/Reader/share/clickMap.js
Normal 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;
|
||||||
Reference in New Issue
Block a user