Разрулил onTouch и onMouse

This commit is contained in:
Book Pauk
2019-01-24 01:13:03 +07:00
parent a2bb50d4ce
commit 7a4d8999ce

View File

@@ -60,6 +60,7 @@ class TextPage extends Vue {
}, 800); }, 800);
this.$root.$on('resize', () => {this.$nextTick(this.onResize)}); this.$root.$on('resize', () => {this.$nextTick(this.onResize)});
this.mobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent);
} }
mounted() { mounted() {
@@ -551,6 +552,8 @@ class TextPage extends Vue {
} }
onTouchStart(event) { onTouchStart(event) {
if (!this.mobile)
return;
this.endClickRepeat(); this.endClickRepeat();
if (event.touches.length == 1) { if (event.touches.length == 1) {
const touch = event.touches[0]; const touch = event.touches[0];
@@ -564,14 +567,20 @@ class TextPage extends Vue {
} }
onTouchEnd() { onTouchEnd() {
if (!this.mobile)
return;
this.endClickRepeat(); this.endClickRepeat();
} }
onTouchCancel() { onTouchCancel() {
if (!this.mobile)
return;
this.endClickRepeat(); this.endClickRepeat();
} }
onMouseDown(event) { onMouseDown(event) {
if (this.mobile)
return;
this.endClickRepeat(); this.endClickRepeat();
if (event.button == 0) { if (event.button == 0) {
const x = event.pageX - this.canvas.offsetLeft; const x = event.pageX - this.canvas.offsetLeft;
@@ -586,10 +595,14 @@ class TextPage extends Vue {
} }
onMouseUp() { onMouseUp() {
if (this.mobile)
return;
this.endClickRepeat(); this.endClickRepeat();
} }
onMouseWheel(event) { onMouseWheel(event) {
if (this.mobile)
return;
if (event.deltaY > 0) { if (event.deltaY > 0) {
this.doDown(); this.doDown();
} else if (event.deltaY < 0) { } else if (event.deltaY < 0) {