oakmac / chessboardjs

JavaScript chessboard
https://chessboardjs.com
MIT License
2k stars 406 forks source link

onMoveEnd/onChange and onDrop different output #245

Open eparisio opened 1 year ago

eparisio commented 1 year ago

Hi, i'm try to implemente chess.js with the board.move() command but i see that the output are different.

onMoveEnd and onChange return the entire board status ({"a8":"bR","b8":"bN","c8":"bB","d8":"bQ","e8":"bK","f8":"bB","g8":"bN","h8":"bR","a7":"bP","b7":"bP","c7":"bP","d7":"bP","e7":"bP","f7":"bP","g7":"bP","h7":"bP","a2":"wP","b2":"wP","c2":"wP","d2":"wP","e2":"wP","f2":"wP","g2":"wP","h2":"wP","a1":"wR","b1":"wN","c1":"wB","d1":"wQ","e1":"wK","f1":"wB","g1":"wN","h1":"wR"}), while onDrop return the new coordinates (e2). Second problem, onMoveEnd don't accept any 'snapback' event to revert the move. how i can use the logic in the example with the onMoveEnd? or some other event ending function? or i must to setup the logic before triggering the board.move() event?