Commit 6f3c4f0 1 parent 7664bcd commit 6f3c4f0 Copy full SHA for 6f3c4f0
File tree 2 files changed +48
-3
lines changed
2 files changed +48
-3
lines changed Original file line number Diff line number Diff line change 1
1
<template >
2
2
<div class =" pgn-display" >
3
- <div class =" pgn-move" v-for =" move in formattedPgn" :key =" move" >
3
+ <div
4
+ class =" pgn-move"
5
+ v-for =" (move, index) in formattedPgn"
6
+ @click =" sendPGNMoves(index)"
7
+ >
4
8
{{ move }}
5
9
</div >
6
10
</div >
@@ -35,6 +39,23 @@ export default {
35
39
return formatted ;
36
40
},
37
41
},
42
+ methods: {
43
+ sendPGNMoves(moveIndex : number ) {
44
+ const formatted = this .formattedPgn ;
45
+ let pgn = " " ;
46
+
47
+ formatted .forEach ((move , index ) => {
48
+ if (index > moveIndex ) {
49
+ return ;
50
+ }
51
+
52
+ pgn += move .trim () + " " ;
53
+ });
54
+
55
+ pgn = pgn .trim ();
56
+ this .$emit (" send-pgn-moves" , pgn );
57
+ },
58
+ },
38
59
};
39
60
</script >
40
61
Original file line number Diff line number Diff line change @@ -200,7 +200,26 @@ export default defineComponent({
200
200
},
201
201
});
202
202
203
- // await this.sendEngineCommand("go");
203
+ this .currentFen = this .game .fen ();
204
+ this .currentPgn = this .game .pgn ();
205
+ },
206
+ async newPgnMoves(pgn : string ) {
207
+ await this .sendEngineCommand (" stop" );
208
+ this .engineLines .clear ();
209
+
210
+ this .game .loadPgn (pgn );
211
+
212
+ this .cg ?.set ({
213
+ fen: this .game .fen (),
214
+ turnColor: this .toColor (),
215
+ lastMove: undefined ,
216
+ movable: {
217
+ color: this .toColor (),
218
+ dests: this .toDests (),
219
+ },
220
+ });
221
+
222
+ this .moveHistory = this .game .history ().join (" " ) + " " ;
204
223
205
224
this .currentFen = this .game .fen ();
206
225
this .currentPgn = this .game .pgn ();
@@ -623,7 +642,12 @@ export default defineComponent({
623
642
/>
624
643
</div >
625
644
<div class =" nav-secondary-content" >
626
- <Pgn class =" game-pgn" :gamePgn =" currentPgn" :key =" currentFen" />
645
+ <Pgn
646
+ class =" game-pgn"
647
+ @send-pgn-moves =" newPgnMoves"
648
+ :gamePgn =" currentPgn"
649
+ :key =" currentFen"
650
+ />
627
651
<div class =" analysis-graph" ></div >
628
652
</div >
629
653
</div >
You can’t perform that action at this time.
0 commit comments