X-Git-Url: https://git.auder.net/?a=blobdiff_plain;ds=sidebyside;f=public%2Fjavascripts%2Fcomponents%2Fgame.js;h=587587fba7260fa3eef94ac38920df4fae106e00;hb=9a3c9f790aa28fd4708faefe41b4624173922c8e;hp=91e13e455f384f773861b31503f4dee50436cfcc;hpb=5e27be422b4d93d8db080c74570dddf3548ee93e;p=vchess.git diff --git a/public/javascripts/components/game.js b/public/javascripts/components/game.js index 91e13e45..587587fb 100644 --- a/public/javascripts/components/game.js +++ b/public/javascripts/components/game.js @@ -257,7 +257,11 @@ Vue.component('my-game', { attrs: { "src": '/images/pieces/' + VariantRules.getPpath(m.appear[0].c+m.appear[0].p) + '.svg' }, 'class': { 'choice-piece': true }, - on: { "click": e => { this.play(m); this.choices=[]; } }, + on: { + "click": e => { this.play(m); this.choices=[]; }, + // NOTE: add 'touchstart' event to fix a problem on smartphones + "touchstart": e => { this.play(m); this.choices=[]; }, + }, }) ] ); @@ -367,7 +371,7 @@ Vue.component('my-game', { attrs: { "aria-label": 'Undo' }, "class": { "small": smallScreen, - "marginleft": true, + "spaceleft": true, }, }, [h('i', { 'class': { "material-icons": true } }, "fast_rewind")]), @@ -391,7 +395,7 @@ Vue.component('my-game', { attrs: { "aria-label": 'Undo' }, "class": { "small": smallScreen, - "marginleft": true, + "spaceleft": true, }, }, [h('i', { 'class': { "material-icons": true } }, "undo")] @@ -1167,7 +1171,6 @@ Vue.component('my-game', { setTimeout(() => { modalBox.checked = false; }, 2000); }, endGame: function(score) { - console.log("call " + score + " " + this.mode); this.score = score; if (["human","computer"].includes(this.mode)) { @@ -1317,7 +1320,8 @@ Vue.component('my-game', { const storageVariant = localStorage.getItem("comp-variant"); if (!!storageVariant) { - if (storageVariant !== variant) + const score = localStorage.getItem("comp-score"); + if (storageVariant !== variant && score == "*") { if (!confirm("Unfinished " + storageVariant + " computer game will be erased")) @@ -1325,12 +1329,8 @@ Vue.component('my-game', { return; } } - else - { - const score = localStorage.getItem("comp-score"); - if (score == "*") - return this.continueGame("computer"); - } + else if (score == "*") + return this.continueGame("computer"); } } this.vr = new VariantRules(fen, []);