Open rilmasaker opened 4 years ago
Board state.currentPosition lists where all the pieces are, this could be looped over to get the current FEN notation. I can work on it for a future PR.
Is a .fen() type method even necessary? You supplying the fen or position object and the fen can easily be obtained from chessboard.js. https://chessboardjs.com/examples#3000
I think this is one of those features that is best left to chess.js. Create a chess.js object and update it in the onDrop
function that you pass to Chessboard
by calling chess.move({ from: sourceSquare, to: targetSquare })
and then you can call chess.fen()
to get the FEN. You can see an example here: https://github.com/willb335/chessboardjsx/blob/master/src/integrations/WithMoveValidation.js
I found solution. I used fen-chess-board and wrote a little bit code to match the position formats. Here is example: https://codesandbox.io/s/funny-williams-q26ku?file=/src/Demo.js
getPosition () gives us only position object, how to get to position FEN. For example, can you add the second argument getPosition function (objPostion: object, fenPosition: string) => void?