Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.