X-Git-Url: https://git.auder.net/?p=vchess.git;a=blobdiff_plain;f=client%2Fsrc%2Fcomponents%2FBaseGame.vue;h=630c83884880a6bdab273fb896e3f92302bd6262;hp=e02462e578396744d76b069545c84fa39810e892;hb=5701c228a422bed7570452b2d24b3193f7653a19;hpb=9ca1e26b79ec1873aa6ac914013160f8593d52cf diff --git a/client/src/components/BaseGame.vue b/client/src/components/BaseGame.vue index e02462e5..630c8388 100644 --- a/client/src/components/BaseGame.vue +++ b/client/src/components/BaseGame.vue @@ -93,6 +93,8 @@ export default { document.getElementById("baseGame").focus(); }, handleKeys: function(e) { + if ([32,37,38,39,40].includes(e.keyCode)) + e.preventDefault(); switch (e.keyCode) { case 37: @@ -101,14 +103,13 @@ export default { case 39: this.play(); break; - case 28: + case 38: this.gotoBegin(); break; case 40: this.gotoEnd(); break; case 32: - e.preventDefault(); this.flip(); break; } @@ -324,8 +325,16 @@ export default { }, gotoBegin: function() { this.vr.re_init(this.game.fenStart); - this.cursor = -1; - this.lastMove = null; + if (this.moves.length > 0 && this.moves[0].notation == "...") + { + this.cursor = 0; + this.lastMove = this.moves[0]; + } + else + { + this.cursor = -1; + this.lastMove = null; + } }, gotoEnd: function() { this.gotoMove(this.moves.length-1);