+ },
+ gotoMove: function(index) {
+ if (this.$refs["board"].choices.length > 0) return;
+ this.$refs["board"].resetCurrentAttempt();
+ if (this.inMultimove) this.cancelCurrentMultimove();
+ if (index == this.cursor) return;
+ if (index < this.cursor) {
+ while (this.cursor > index)
+ this.undo(null, null, "light");
+ }
+ else {
+ // index > this.cursor)
+ while (this.cursor < index)
+ this.play(null, null, "light");
+ }
+ // NOTE: next line also re-assign cursor, but it's very light
+ this.positionCursorTo(index);
+ this.incheck = this.vr.getCheckSquares();
+ this.emitFenIfAnalyze();
+ },
+ gotoBegin: function() {
+ if (this.$refs["board"].choices.length > 0) return;
+ this.$refs["board"].resetCurrentAttempt();
+ if (this.inMultimove) this.cancelCurrentMultimove();
+ const minCursor =
+ this.moves.length > 0 && this.moves[0].notation == "..."
+ ? 1
+ : 0;
+ while (this.cursor >= minCursor) this.undo(null, null, "light");
+ this.lastMove = (minCursor == 1 ? this.moves[0] : null);
+ this.incheck = this.vr.getCheckSquares();
+ this.emitFenIfAnalyze();