From 10addfff8239405375a1c99b8582f4d4d8283d0a Mon Sep 17 00:00:00 2001 From: Benjamin Auder <benjamin.auder@somewhere> Date: Tue, 21 Apr 2020 15:20:15 +0200 Subject: [PATCH] Use clientXY and not pageXY for touch screens. Should work better :) --- client/src/components/Board.vue | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/client/src/components/Board.vue b/client/src/components/Board.vue index 88a34198..48bdd872 100644 --- a/client/src/components/Board.vue +++ b/client/src/components/Board.vue @@ -675,12 +675,7 @@ export default { // Cancel if off boardContainer const [offsetX, offsetY] = this.mobileBrowser - ? - [ - e.changedTouches[0].pageX, - // TODO: fixing attempt for smartphones, removing window.scrollY - e.changedTouches[0].pageY - window.scrollY - ] + ? [e.changedTouches[0].clientX, e.changedTouches[0].clientY] : [e.clientX, e.clientY]; if ( offsetX < this.containerPos.left || @@ -760,11 +755,7 @@ export default { // Obtain the move from start and end squares const [offsetX, offsetY] = this.mobileBrowser - ? - [ - e.changedTouches[0].pageX, - e.changedTouches[0].pageY - window.scrollY - ] + ? [e.changedTouches[0].clientX, e.changedTouches[0].clientY] : [e.clientX, e.clientY]; let landing = document.elementFromPoint(offsetX, offsetY); // Next condition: classList.contains(piece) fails because of marks -- 2.44.0