From: Benjamin Auder Date: Tue, 21 Apr 2020 13:20:15 +0000 (+0200) Subject: Use clientXY and not pageXY for touch screens. Should work better :) X-Git-Url: https://git.auder.net/variants/Chakart/css/assets/doc/DESCRIPTION?a=commitdiff_plain;h=10addfff8239405375a1c99b8582f4d4d8283d0a;p=vchess.git Use clientXY and not pageXY for touch screens. Should work better :) --- 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