X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fcomponents%2FMoveList.vue;h=d2ae3f3514e4081e0fe2a74ac5ac1057ec618161;hb=49dad26138d3dee0cacbb94ad8d3d3eff12c477a;hp=2bad3014fd237be44bb9316dbf8b73f11304fde8;hpb=08a5069cbf419f204b69135a0860ba6d53affb7f;p=vchess.git diff --git a/client/src/components/MoveList.vue b/client/src/components/MoveList.vue index 2bad3014..d2ae3f35 100644 --- a/client/src/components/MoveList.vue +++ b/client/src/components/MoveList.vue @@ -53,7 +53,7 @@ div | {{ notation(moves[moveIdx]) }} .td( v-if="moveIdx < moves.length-1" - :class="{'highlight-lm': highlightBlackmove(moveIdx)}" + :class="{'highlight-lm': highlightBlackmove(moveIdx+1)}" @click="() => gotoMove(moveIdx+1)" ) | {{ notation(moves[moveIdx+1]) }} @@ -114,9 +114,11 @@ export default { // $nextTick to wait for table > tr to be rendered this.$nextTick(() => { let curMove = document.querySelector(".td.highlight-lm"); - if (!curMove && this.moves.length > 0) + if (!curMove && this.moves.length > 0) { // Cursor is before game beginning, and some moves were made: - curMove = document.querySelector(".moves-list > .tr:first-child > .td"); + curMove = + document.querySelector(".moves-list > .tr:first-child > .td"); + } if (!!curMove) { curMove.scrollIntoView({ behavior: "auto", @@ -137,8 +139,8 @@ export default { }, highlightBlackmove: function(moveIdx) { return ( - this.cursor == moveIdx + 1 || - (this.show == "byrow" && this.cursor == moveIdx + 2) + this.cursor == moveIdx || + (this.show == "byrow" && this.cursor == moveIdx + 1) ); }, gotoMove: function(index) { @@ -147,6 +149,9 @@ export default { adjustBoard: function() { const boardContainer = document.getElementById("boardContainer"); if (!boardContainer) return; //no board on page + let arrows = document.getElementById("arrowCanvas"); + // TODO: arrows on board don't scale + if (!!arrows) this.$emit("reset-arrows"); const k = document.getElementById("boardSize").value; const movesWidth = window.innerWidth >= 768 ? 280 : 0; const minBoardWidth = 240; //TODO: these 240 and 280 are arbitrary...