From c3ebb1b09eca2d61ea0d30f4e0c5a38177923b6a Mon Sep 17 00:00:00 2001 From: Book Pauk Date: Fri, 8 Feb 2019 19:40:52 +0700 Subject: [PATCH] =?UTF-8?q?=D0=A0=D0=B5=D1=84=D0=B0=D0=BA=D1=82=D0=BE?= =?UTF-8?q?=D1=80=D0=B8=D0=BD=D0=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/components/Reader/TextPage/TextPage.vue | 16 ++++++---------- client/components/Reader/share/clickMap.js | 7 +++++++ 2 files changed, 13 insertions(+), 10 deletions(-) create mode 100644 client/components/Reader/share/clickMap.js diff --git a/client/components/Reader/TextPage/TextPage.vue b/client/components/Reader/TextPage/TextPage.vue index 0e39e35d..4ab196c8 100644 --- a/client/components/Reader/TextPage/TextPage.vue +++ b/client/components/Reader/TextPage/TextPage.vue @@ -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; } } diff --git a/client/components/Reader/share/clickMap.js b/client/components/Reader/share/clickMap.js new file mode 100644 index 00000000..559a03e8 --- /dev/null +++ b/client/components/Reader/share/clickMap.js @@ -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; \ No newline at end of file