Some more traces... (+ fix lastMove when exit analyze)
[vchess.git] / client / src / components / BaseGame.vue
index be58295..30533f7 100644 (file)
@@ -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");
       }
     },
@@ -466,7 +468,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);
           }
@@ -492,6 +494,11 @@ export default {
         (function executeMove() {
 console.log("execute move " + move.length);
           const smove = move[moveIdx++];
+
+console.log(smove);
+          console.log(animate + " " + smove.start.x);
+
+
           // NOTE: condition "smove.start.x >= 0" required for Dynamo,
           // because second move may be empty.
           if (animate && smove.start.x >= 0) {