Clariity / react-chessboard

The React Chessboard Library used at ChessOpenings.co.uk. Inspired and adapted from the unmaintained Chessboard.jsx.
https://react-chessboard.vercel.app
MIT License
348 stars 105 forks source link

fix: premoved piece disappearing #120

Closed Manukyanq closed 9 months ago

Manukyanq commented 10 months ago

The fix of https://github.com/Clariity/react-chessboard/issues/118

vercel[bot] commented 10 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-chessboard ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 23, 2024 4:58pm
Manukyanq commented 10 months ago

I've fixed also another issue, when two premoved pieces target the same square the last premoved piece should be visible not the first one. In the example below, we do two premoves: rook to a1, then queen to a1, and logically the queen should be visible after these two moves not the rook

https://github.com/Clariity/react-chessboard/assets/42891870/28c35e52-1d0c-4825-8ea3-199cb675a14f

Clariity commented 10 months ago

Could an option be to look through the premove queue backwards and see what the latest premove target on the square is?

Am away from my pc now until mid January so won't be able to look deeply into it

Manukyanq commented 9 months ago

Could an option be to look through the premove queue backwards and see what the latest premove target on the square is?

Am away from my pc now until mid January so won't be able to look deeply into it

I think the complexity is the same. Or do I miss something?