Closed willdelphia closed 1 year ago
Hi. This is solved with very few lines of code in the move validation example.
You can simply execute a "setPosition" after entering the move.
if (result) {
this.chessboard.state.moveInputProcess.then(() => { // wait for the move input process has finished
this.chessboard.setPosition(chess.fen(), true).then(() => { // update position, maybe castled and wait for animation has finished
makeEngineMove(event.chessboard)
})
})
}
You could also take a look at the "Playfield" extension, where the move validation and more is implemented in a more sophisticated (but also a bit more complicated) way.
Thanks, I'll give that a try.
Sorry if this isn't an issue with the library per se. But I have installed a chess engine along with this cm-chessboard to accept legal moves and if they are legal update allow them on the cm-chessboard instance using the drag and drop validation method. The issue is that the the rook will remain in place after a legal castling move. Is there a simple way to make the rook jump the king after a successful castle? Or will I have to code my own solution to make this happen. Thanks.