Поправка багов координат мыши

This commit is contained in:
Book Pauk
2019-01-20 19:20:38 +07:00
parent 14eac6af3a
commit fea10c880e

View File

@@ -471,8 +471,10 @@ class TextPage extends Vue {
this.endClickRepeat(); this.endClickRepeat();
if (event.touches.length == 1) { if (event.touches.length == 1) {
const touch = event.touches[0]; const touch = event.touches[0];
this.handleClick(touch.clientX, touch.clientY); const x = touch.pageX - this.canvas.offsetLeft;
this.startClickRepeat(touch.clientX, touch.clientY); const y = touch.pageY - this.canvas.offsetTop;
this.handleClick(x, y);
this.startClickRepeat(x, y);
} }
} }
@@ -483,8 +485,10 @@ class TextPage extends Vue {
onMouseDown(event) { onMouseDown(event) {
this.endClickRepeat(); this.endClickRepeat();
if (event.button == 0) { if (event.button == 0) {
this.handleClick(event.clientX, event.clientY); const x = event.pageX - this.canvas.offsetLeft;
this.startClickRepeat(event.clientX, event.clientY); const y = event.pageY - this.canvas.offsetTop;
this.handleClick(x, y);
this.startClickRepeat(x, y);
} else if (event.button == 2) { } else if (event.button == 2) {
this.doToolBarToggle(); this.doToolBarToggle();
} }