)
#turnIndicator(v-if="showTurn") {{ turn }}
#controls
- button(@click="gotoBegin()") <<
- button(@click="undo()") <
- button(v-if="canFlip" @click="flip()") ⇅
- button(@click="play()") >
- button(@click="gotoEnd()") >>
+ button(@click="gotoBegin()")
+ img.inline(src="/images/icons/fast-forward_rev.svg")
+ button(@click="undo()")
+ img.inline(src="/images/icons/play_rev.svg")
+ button(v-if="canFlip" @click="flip()")
+ img.inline(src="/images/icons/flip.svg")
+ button(@click="play()")
+ img.inline(src="/images/icons/play.svg")
+ button(@click="gotoEnd()")
+ img.inline(src="/images/icons/fast-forward.svg")
#belowControls
#downloadDiv(v-if="allowDownloadPGN")
a#download(href="#")
| {{ st.tr["Rules"] }}
#movesList
MoveList(
- v-if="showMoves != 'none'"
:show="showMoves"
:score="game.score"
:message="game.scoreMsg"
callback();
}, 250);
},
+ // For Analyse mode:
+ emitFenIfAnalyze: function() {
+ if (this.game.mode == "analyze") {
+ this.$emit(
+ "fenchange",
+ this.lastMove ? this.lastMove.fen : this.game.fenStart
+ );
+ }
+ },
// "light": if gotoMove() or gotoEnd()
// data: some custom data (addTime) to be re-emitted
play: function(move, received, light, data) {
if (!navigate) {
if (!this.inMultimove) {
if (this.cursor < this.moves.length - 1)
- this.moves = this.moves.slice(0, Math.max(this.cursor, 0));
+ this.moves = this.moves.slice(0, this.cursor + 1);
this.moves.push(smove);
this.inMultimove = true; //potentially
this.cursor++;
})();
};
const afterMove = (smove, initurn) => {
- if (this.st.settings.sound == 2)
- new Audio("/sounds/move.mp3").play().catch(() => {});
if (this.vr.turn != initurn) {
// Turn has changed: move is complete
+ if (!smove.fen) {
+ // NOTE: only FEN of last sub-move is required (thus setting it here)
+ smove.fen = this.vr.getFen();
+ this.emitFenIfAnalyze();
+ }
this.inMultimove = false;
const score = this.vr.getCurrentScore();
if (score != "*") {
const message = getScoreMessage(score);
if (!navigate && this.game.mode != "analyze")
this.$emit("gameover", score, message);
- // Just show score on screen (allow undo)
- else this.showEndgameMsg(score + " . " + this.st.tr[message]);
+ else if (this.game.mode == "analyze")
+ // Just show score on screen (allow undo)
+ this.showEndgameMsg(score + " . " + this.st.tr[message]);
}
if (!navigate && this.game.mode != "analyze") {
const L = this.moves.length;
if (!Array.isArray(move)) move = [move];
for (let i=0; i < move.length; i++) this.vr.play(move[i]);
}
- else playMove();
+ else {
+ playMove();
+ this.emitFenIfAnalyze();
+ }
this.cursor++;
return;
}
playMove();
},
cancelCurrentMultimove: function() {
- // Cancel current multi-move
const L = this.moves.length;
let move = this.moves[L-1];
if (!Array.isArray(move)) move = [move];
if (light) this.cursor--;
else {
this.positionCursorTo(this.cursor - 1);
- if (this.st.settings.sound == 2)
- new Audio("/sounds/undo.mp3").play().catch(() => {});
this.incheck = this.vr.getCheckSquares(this.vr.turn);
+ this.emitFenIfAnalyze();
}
}
},
// NOTE: next line also re-assign cursor, but it's very light
this.positionCursorTo(index);
this.incheck = this.vr.getCheckSquares(this.vr.turn);
+ this.emitFenIfAnalyze();
},
gotoBegin: function() {
if (this.inMultimove) this.cancelCurrentMultimove();
this.lastMove = null;
}
this.incheck = [];
+ this.emitFenIfAnalyze();
},
gotoEnd: function() {
if (this.cursor == this.moves.length - 1) return;
this.gotoMove(this.moves.length - 1);
+ this.emitFenIfAnalyze();
},
flip: function() {
this.orientation = V.GetOppCol(this.orientation);
#controls
margin: 0 auto
text-align: center
+ display: flex
button
display: inline-block
width: 20%
margin: 0
+ img.inline
+ height: 24px
+ padding-top: 5px
+ @media screen and (max-width: 767px)
+ img.inline
+ height: 18px
#turnIndicator
text-align: center