Fix moves highlight in moves list for Apocalypse and Synchrone
[vchess.git] / client / src / components / MoveList.vue
index d2ae3f3..a9fa983 100644 (file)
@@ -101,10 +101,8 @@ export default {
     window.addEventListener("resize", () => {
       if (!timeoutLaunched) {
         timeoutLaunched = true;
-        setTimeout(() => {
-          this.adjustBoard();
-          timeoutLaunched = false;
-        }, 500);
+        this.adjustBoard();
+        setTimeout(() => { timeoutLaunched = false; }, 500);
       }
     });
   },
@@ -140,7 +138,14 @@ export default {
     highlightBlackmove: function(moveIdx) {
       return (
         this.cursor == moveIdx ||
-        (this.show == "byrow" && this.cursor == moveIdx + 1)
+        (
+          // If display by rows, hightlight last black move while the white
+          // move is being played:
+          this.show == "byrow" &&
+          this.cursor == moveIdx + 1 &&
+          // ...except if cursor is behind in the game:
+          this.cursor == this.moves.length - 1
+        )
       );
     },
     gotoMove: function(index) {