X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fcomponents%2FBaseGame.vue;h=cf4d7629adc7cc5448028794e32cead56ed651cb;hb=264fa4e4a972aacd9897c4ea0c4070e6755c0f8e;hp=be582950b822cf7f6e0fd35599c8fe84f202b8af;hpb=b20f4bd2d6366bb099d2f95831e67e83a61fae96;p=vchess.git diff --git a/client/src/components/BaseGame.vue b/client/src/components/BaseGame.vue index be582950..cf4d7629 100644 --- a/client/src/components/BaseGame.vue +++ b/client/src/components/BaseGame.vue @@ -275,6 +275,8 @@ export default { } this.vr = new V(fen); this.incheck = this.vr.getCheckSquares(); + if (this.cursor >= 0) this.lastMove = this.moves[this.cursor]; + else this.lastMove = null; document.getElementById("analyzeBtn").classList.remove("active"); } }, @@ -430,10 +432,6 @@ export default { return; } if (!!received) { - - if (this.mode == "analyze") { console.log("received move"); - console.log(move); } - if (this.mode == "analyze") this.toggleAnalyze(); if (this.cursor < this.moves.length - 1) // To play a received move, cursor must be at the end of the game: @@ -466,7 +464,7 @@ export default { this.lastMove = smove; // Condition is "!navigate" but we mean "!this.autoplay" if (!navigate) { - IF (this.cursor < this.moves.length - 1) + if (this.cursor < this.moves.length - 1) this.moves = this.moves.slice(0, this.cursor + 1); this.moves.push(smove); } @@ -490,16 +488,12 @@ export default { let self = this; const initurn = this.vr.turn; (function executeMove() { -console.log("execute move " + move.length); const smove = move[moveIdx++]; // NOTE: condition "smove.start.x >= 0" required for Dynamo, // because second move may be empty. if (animate && smove.start.x >= 0) { self.animateMove(smove, () => { playSubmove(smove); - -console.log(moveIdx + " " + move.length); - if (moveIdx < move.length) setTimeout(executeMove, 500); else afterMove(smove, initurn); @@ -531,9 +525,6 @@ console.log(moveIdx + " " + move.length); }; const afterMove = (smove, initurn) => { if (this.vr.turn != initurn) { - -console.log(smove); - // Turn has changed: move is complete if (!smove.fen) // NOTE: only FEN of last sub-move is required (=> setting it here)