X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fviews%2FGame.vue;h=878e7718e8101fea08ce48402a49d79785f3c31b;hb=5e38a642ffa0ef5f0076aa0df05aa935b027f649;hp=8f40deac334c80956f37c15b92b74174d0aa2d49;hpb=9eccb8aa675d95d3a66cd3269e2977980e41d97d;p=vchess.git diff --git a/client/src/views/Game.vue b/client/src/views/Game.vue index 8f40deac..878e7718 100644 --- a/client/src/views/Game.vue +++ b/client/src/views/Game.vue @@ -807,10 +807,25 @@ export default { } } this.$refs["basegame"].play(movePlus.move, "received"); - this.game.clocks[moveColIdx] = movePlus.clock; - this.processMove( - movePlus.move, - { receiveMyMove: receiveMyMove } + // Freeze time while the move is being play + // (TODO: a callback would be cleaner here) + clearInterval(this.clockUpdate); + this.clockUpdate = null; + const freezeDuration = ["all", "highlight"].includes(V.ShowMoves) + // 250 = length of animation, 500 = delay between sub-moves + ? 250 + 750 * + (Array.isArray(movePlus.move) ? movePlus.move.length - 1 : 0) + // Incomplete information: no move animation + : 0; + setTimeout( + () => { + this.game.clocks[moveColIdx] = movePlus.clock; + this.processMove( + movePlus.move, + { receiveMyMove: receiveMyMove } + ); + }, + freezeDuration ); } }