From b1a7df1b408f0c75377a821d8b621a612fb98bea Mon Sep 17 00:00:00 2001 From: Book Pauk Date: Sat, 19 Jan 2019 00:52:20 +0700 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB=20?= =?UTF-8?q?=D1=80=D0=B5=D0=B0=D0=BA=D1=86=D0=B8=D1=8E=20=D0=BD=D0=B0=20?= =?UTF-8?q?=D0=BF=D1=80=D0=B0=D0=B2=D1=83=D1=8E=20=D0=BA=D0=BD=D0=BE=D0=BF?= =?UTF-8?q?=D0=BA=D1=83=20=D0=BC=D1=8B=D1=88=D0=B8,=20=D1=80=D0=B5=D1=84?= =?UTF-8?q?=D0=B0=D0=BA=D1=82=D0=BE=D1=80=D0=B8=D0=BD=D0=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/Reader/TextPage/TextPage.vue | 33 ++++++++++++++++--- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/client/components/Reader/TextPage/TextPage.vue b/client/components/Reader/TextPage/TextPage.vue index bc7ff48b..83528eaf 100644 --- a/client/components/Reader/TextPage/TextPage.vue +++ b/client/components/Reader/TextPage/TextPage.vue @@ -1,6 +1,6 @@ @@ -328,20 +328,41 @@ class TextPage extends Vue { onTouchStart(event) { if (event.touches.length == 1) { - this.onMouseDown(event.touches[0]); + const touch = event.touches[0]; + const result = this.handleClick(touch.clientX, touch.clientY) + + if (result) { + event.stopPropagation(); + event.preventDefault(); + } } } onMouseDown(event) { + let result = false; + if (event.button == 0) { + result = this.handleClick(event.clientX, event.clientY); + } else if (event.button == 2) { + this.doToolBarToggle(); + result = true; + } + + if (result) { + event.stopPropagation(); + event.preventDefault(); + } + } + + handleClick(pointX, pointY) { const mouseLegend = { 40: {30: 'PgUp', 100: 'PgDown'}, 60: {40: 'Up', 60: 'Menu', 100: 'Down'}, 100: {30: 'PgUp', 100: 'PgDown'} }; - const w = event.clientX/this.realWidth*100; - const h = event.clientY/this.realHeight*100; + const w = pointX/this.realWidth*100; + const h = pointY/this.realHeight*100; let action = ''; loops: { @@ -375,7 +396,9 @@ class TextPage extends Vue { // Nothing } - } + return !!action; + } + } //-----------------------------------------------------------------------------