-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Example with clicking as opposed to dragging for entering moves #51
Comments
Thank you! 🎉 🙏 |
This already works. Including the call to chess to validate moves.... let startingSquare = null const game = new Chess() const board = window.Chessboard2('myBoard', { const statusEl = byId('gameStatus') function onMousedownSquare (evt, domEvt) {
} function byId (id) { |
And this is already a full working example !! What a versatile program!! (I know zero about programming ) /* Attempting to input moves with clicks, as opposed to dragging let startingSquare = null const game = new Chess() const board = window.Chessboard2('myBoard', { const statusEl = byId('gameStatus') updateStatus() function onMousedownSquare (evt, domEvt) { // do we have a starting square ?
} else {
} function updateStatus () {
} function byId (id) { |
A further example with a different starting positionSo simple /* Attempting to input moves with clicks, as opposed to dragging let startingSquare = null var fenposition = 'rnbq1rk1/pp2p1bp/2pp1np1/3P1p2/2P5/2N2NP1/PP2PPBP/R1BQ1RK1 b - - 0 8' const game = new Chess(fenposition) const board = window.Chessboard2('myBoard', { const statusEl = byId('gameStatus') updateStatus() function onMousedownSquare (evt, domEvt) { // do we have a starting square ?
} else {
} function updateStatus () {
} function byId (id) { |
I guess by now I could probably do it myself, but it would be nice to have an example like 'Allow only Legal Moves' that instead of dragging uses clicking on starting and end squares.
I suppose combining 'Allow only Legal Moves' with 'Click to Create Arrows' would do the trick, but of course it would be nice if it was 'officially done' . Otherwise, I guess I will put it on my 'to do list'
Many thanks on a magnificent project. I have now Chessboard and Chessboard2 working very well. And eliminating jQuery also an added bonus...
The text was updated successfully, but these errors were encountered: