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",
{
}
},
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",
{
".svg"
},
class: { "choice-piece": true },
- on: {
- click: () => {
- this.play(m);
- this.choices = [];
- }
- }
+ on: onClick
})
]
);