use .after FEN for move navigation
This commit is contained in:
@@ -430,7 +430,7 @@ export default function GamePage({ initialLobby }: { initialLobby: Game }) {
|
|||||||
function navigateMove(index: number | null | "prev") {
|
function navigateMove(index: number | null | "prev") {
|
||||||
const history = lobby.actualGame.history({ verbose: true });
|
const history = lobby.actualGame.history({ verbose: true });
|
||||||
|
|
||||||
if (index === null || index >= history.length - 1 || !history.length) {
|
if (index === null || (index !== "prev" && index >= history.length - 1) || !history.length) {
|
||||||
// last move
|
// last move
|
||||||
setNavIndex(null);
|
setNavIndex(null);
|
||||||
setNavFen(null);
|
setNavFen(null);
|
||||||
@@ -446,7 +446,7 @@ export default function GamePage({ initialLobby }: { initialLobby: Game }) {
|
|||||||
chessboardRef.current?.clearPremoves(false);
|
chessboardRef.current?.clearPremoves(false);
|
||||||
|
|
||||||
setNavIndex(index);
|
setNavIndex(index);
|
||||||
setNavFen(history[index + 1].fen);
|
setNavFen(history[index].after);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getNavMoveSquares() {
|
function getNavMoveSquares() {
|
||||||
|
|||||||
Reference in New Issue
Block a user