projects
/
vchess.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Hopefully Eightpieces is less buggish now
[vchess.git]
/
client
/
src
/
components
/
Board.vue
diff --git
a/client/src/components/Board.vue
b/client/src/components/Board.vue
index
fdeeef3
..
c2de176
100644
(file)
--- a/
client/src/components/Board.vue
+++ b/
client/src/components/Board.vue
@@
-25,6
+25,7
@@
export default {
selectedPiece: null, //moving piece (or clicked piece)
start: null, //pixels coordinates + id of starting square (click or drag)
click: "",
selectedPiece: null, //moving piece (or clicked piece)
start: null, //pixels coordinates + id of starting square (click or drag)
click: "",
+ clickTime: 0,
settings: store.state.settings
};
},
settings: store.state.settings
};
},
@@
-112,7
+113,12
@@
export default {
attrs: {
src:
"/images/pieces/" +
attrs: {
src:
"/images/pieces/" +
- this.vr.getPpath(this.vr.board[ci][cj], this.userColor, this.score) +
+ this.vr.getPpath(
+ this.vr.board[ci][cj],
+ // Extra args useful for some variants:
+ this.userColor,
+ this.score,
+ this.orientation) +
".svg"
}
})
".svg"
}
})
@@
-298,6
+304,9
@@
export default {
// A "choice" is a move
const applyMove = (e) => {
e.stopPropagation();
// A "choice" is a move
const applyMove = (e) => {
e.stopPropagation();
+ // Force a delay between move is shown and clicked
+ // (otherwise a "double-click" bug might occur)
+ if (Date.now() - this.clickTime < 200) return;
this.play(m);
this.choices = [];
};
this.play(m);
this.choices = [];
};
@@
-322,7
+331,10
@@
export default {
attrs: {
src:
"/images/pieces/" +
attrs: {
src:
"/images/pieces/" +
- this.vr.getPpath(m.appear[0].c + m.appear[0].p) +
+ this.vr.getPPpath(
+ m.appear[0].c + m.appear[0].p,
+ // Extra arg useful for some variants:
+ this.orientation) +
".svg"
},
class: { "choice-piece": true },
".svg"
},
class: { "choice-piece": true },
@@
-441,8
+453,10
@@
export default {
let endSquare = getSquareFromId(landing.id);
let moves = this.findMatchingMoves(endSquare);
this.possibleMoves = [];
let endSquare = getSquareFromId(landing.id);
let moves = this.findMatchingMoves(endSquare);
this.possibleMoves = [];
- if (moves.length > 1) this.choices = moves;
- else if (moves.length == 1) this.play(moves[0]);
+ if (moves.length > 1) {
+ this.clickTime = Date.now();
+ this.choices = moves;
+ } else if (moves.length == 1) this.play(moves[0]);
// else: forbidden move attempt
},
findMatchingMoves: function(endSquare) {
// else: forbidden move attempt
},
findMatchingMoves: function(endSquare) {
@@
-524,18
+538,18
@@
img.ghost
// TODO: no predefined highlight colors, but layers. How?
.light-square.lichess.highlight-light
// TODO: no predefined highlight colors, but layers. How?
.light-square.lichess.highlight-light
- background-color: #cdd26a
!important
+ background-color: #cdd26a
.dark-square.lichess.highlight-dark
.dark-square.lichess.highlight-dark
- background-color: #aaa23a
!important
+ background-color: #aaa23a
.light-square.chesscom.highlight-light
.light-square.chesscom.highlight-light
- background-color: #f7f783
!important
+ background-color: #f7f783
.dark-square.chesscom.highlight-dark
.dark-square.chesscom.highlight-dark
- background-color: #bacb44
!important
+ background-color: #bacb44
.light-square.chesstempo.highlight-light
.light-square.chesstempo.highlight-light
- background-color: #9f9fff
!important
+ background-color: #9f9fff
.dark-square.chesstempo.highlight-dark
.dark-square.chesstempo.highlight-dark
- background-color: #557fff
!important
+ background-color: #557fff
</style>
</style>