projects
/
vchess.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Eightpieces almost ready
[vchess.git]
/
client
/
src
/
components
/
Board.vue
diff --git
a/client/src/components/Board.vue
b/client/src/components/Board.vue
index
5080e84
..
fdeeef3
100644
(file)
--- 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) {
if (!!this.vr.reserve) elementArray.push(reserveBottom);
const boardElt = document.querySelector(".game");
if (this.choices.length > 0 && !!boardElt) {
- //
n
o choices to show at first drawing
+ //
N
o choices to show at first drawing
const squareWidth = boardElt.offsetWidth / sizeY;
const offset = [boardElt.offsetTop, boardElt.offsetLeft];
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",
{
const choices = h(
"div",
{
@@
-294,7
+295,16
@@
export default {
}
},
this.choices.map(m => {
}
},
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",
{
return h(
"div",
{
@@
-316,12
+326,7
@@
export default {
".svg"
},
class: { "choice-piece": true },
".svg"
},
class: { "choice-piece": true },
- on: {
- click: () => {
- this.play(m);
- this.choices = [];
- }
- }
+ on: onClick
})
]
);
})
]
);