shaack / cm-chessboard

A JavaScript chessboard without dependencies. Rendered in SVG, coded in ES6. Views FEN, handles move input, animated, responsive, expandable
MIT License
209 stars 63 forks source link

moveInput already enabled error #116

Closed djeetee closed 1 year ago

djeetee commented 1 year ago

after the upgrade to 7.6.5 i'm getting this error:

Uncaught (in promise) Error: moveInput already enabled

Was anything changed in enableMoveInput() to trigger this?

I will look a the code later, but i think it is because the user can jump back and forth between moves and I wanted to make sure input was enabled for the right color hence the extra 'enableMoveInput()`

This brings back my previous question about the method's behaviour when color is not specified.

thanks.

shaack commented 1 year ago

Yes, cm-chessboard now detects, when multiple enableMoveInput() are registered without disableMoveInput(). You could enable the move input for both colors, with not setting the color parameter. So you can just leave it enabled. But in my projects I disable the Input after every move, like in the validate moves example. The reference implementation for now is done in my new cm-chessboard-playfield extension.

djeetee commented 1 year ago

Fixed.

Btw, I'm following the structure of validate moves example but I wish I looked at the your playfield code earlier. I like it.

Onto the engine piece code.

thanks again Stefan.

shaack commented 1 year ago

I will close this for now, if you have more questions we could re-open or create a new ticket.