From: Benjamin Auder Date: Fri, 13 Mar 2020 09:36:19 +0000 (+0100) Subject: Attempt to fix promotions on mobile browsers X-Git-Url: https://git.auder.net/variants/Apocalypse/scripts/current/pieces/%24%7BgetWhatsApp%28link%29%7D?a=commitdiff_plain;h=fabb53f2e009b79c2c87ea7683e45b3202d4a934;p=vchess.git Attempt to fix promotions on mobile browsers --- diff --git a/client/src/components/Board.vue b/client/src/components/Board.vue index 5080e846..f2fd44c3 100644 --- a/client/src/components/Board.vue +++ b/client/src/components/Board.vue @@ -294,7 +294,16 @@ export default { } }, this.choices.map(m => { - //a "choice" is a move + // A "choice" is a move + const applyMove = (e) => { + e.stopPropagation(); + this.play(m); + this.choices = []; + }; + const onClick = + this.mobileBrowser + ? { touchend: applyMove } + : { mouseup: applyMove }; return h( "div", { @@ -316,12 +325,7 @@ export default { ".svg" }, class: { "choice-piece": true }, - on: { - click: () => { - this.play(m); - this.choices = []; - } - } + on: onClick }) ] );