Fix enter/exit analyze mode when in promotion or showing marks on boards
authorBenjamin Auder <benjamin.auder@somewhere>
Thu, 9 Apr 2020 15:06:47 +0000 (17:06 +0200)
committerBenjamin Auder <benjamin.auder@somewhere>
Thu, 9 Apr 2020 15:06:47 +0000 (17:06 +0200)
client/src/components/BaseGame.vue

index a1af478..1840882 100644 (file)
@@ -258,8 +258,8 @@ export default {
       else this.lastMove = null;
     },
     toggleAnalyze: function() {
       else this.lastMove = null;
     },
     toggleAnalyze: function() {
-      // Autoplay has priority:
-      if (this.autoplay) return;
+      // Freeze while choices are shown (and autoplay has priority)
+      if (this.$refs["board"].choices.length > 0 || this.autoplay) return;
       if (this.mode != "analyze") {
         // Enter analyze mode:
         if (this.inMultimove) this.cancelCurrentMultimove();
       if (this.mode != "analyze") {
         // Enter analyze mode:
         if (this.inMultimove) this.cancelCurrentMultimove();
@@ -282,6 +282,7 @@ export default {
         }
         this.vr = new V(fen);
         this.inMultimove = false; //in case of
         }
         this.vr = new V(fen);
         this.inMultimove = false; //in case of
+        this.$refs["board"].resetCurrentAttempt(); //also in case of
         this.incheck = this.vr.getCheckSquares();
         if (this.cursor >= 0) this.lastMove = this.moves[this.cursor];
         else this.lastMove = null;
         this.incheck = this.vr.getCheckSquares();
         if (this.cursor >= 0) this.lastMove = this.moves[this.cursor];
         else this.lastMove = null;