X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fcomponents%2FMoveList.vue;h=4c351dd51cf54207fcd242d125a0bb85fac57bbc;hb=1ef65040168ab7d55ce921abc9d63644a937d689;hp=91d138efb41c1ef7408ec7c7d82565284b7c42a8;hpb=2c5d7b20742b802d9c47916915c1114bcfc9a9c3;p=vchess.git diff --git a/client/src/components/MoveList.vue b/client/src/components/MoveList.vue index 91d138ef..4c351dd5 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]) }} @@ -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); } }); }, @@ -139,8 +137,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) { @@ -149,6 +147,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...