Skip to content
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

Crazyhouse drops by click-click #292

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

VVestin
Copy link

@VVestin VVestin commented Nov 20, 2023

fixes lichess-org/lila#12866
This change is dependant on this follow-up PR on lila that adds a CSS class for the selected piece within the pocket:
lichess-org/lila#14052

This change makes it so that when you click an external piece and try to drag it onto the board and drop it (such as in the crazyhouse variant), you have the option to click and select (previously only drag and drop was possible).

I implemented this by making the dragNewPiece function in drag.ts also select the new piece.
Then if the drag ends on the same element where it started, we count that as a click and select that piece.
When the user clicks an empty space on the board, we drop the selected piece onto that square.

I also added a board to demo.html that allows you to drop pieces on it.

I also made it respect state.selectable.enabled and state.draggable.enabled for external pieces the same as pieces on the board because previously dragging was the only way to drop pieces in crazyhouse.
With this change, we should respect the user's preferences for whether they allow dragging, clicking, or both.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Crazyhouse drops by click-click
1 participant