X-Git-Url: https://git.auder.net/pieces/Checkered/cb.svg?a=blobdiff_plain;f=client%2Fsrc%2Fcomponents%2FBoard.vue;h=fdeeef319b7bcdcfc8dd2f29a044e7f9ce4370fc;hb=afbf3ca7151ef15a9e579b0f913683ab212396c4;hp=5080e846b650d098cc6674f2aa26db96177d9e2f;hpb=28b32b4fc7c23b1c72bed68e1897576c5be46c3d;p=vchess.git diff --git a/client/src/components/Board.vue b/client/src/components/Board.vue index 5080e846..fdeeef31 100644 --- a/client/src/components/Board.vue +++ b/client/src/components/Board.vue @@ -275,9 +275,10 @@ export default { if (!!this.vr.reserve) elementArray.push(reserveBottom); const boardElt = document.querySelector(".game"); if (this.choices.length > 0 && !!boardElt) { - //no choices to show at first drawing + // No choices to show at first drawing const squareWidth = boardElt.offsetWidth / sizeY; const offset = [boardElt.offsetTop, boardElt.offsetLeft]; + // TODO: multi-rows if more than V.size.y pieces (as inEightpieces) const choices = h( "div", { @@ -294,7 +295,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 +326,7 @@ export default { ".svg" }, class: { "choice-piece": true }, - on: { - click: () => { - this.play(m); - this.choices = []; - } - } + on: onClick }) ] );