Board Editor: Tap to place piece #2126
Open
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.
On the board editor page, you used to only be able to add new pieces by dragging them onto the board. This always bugged me, and I imagine it must be horrible on tablets due to the large screen and large distance to drag. I also thought there was something wrong with the app when I tried to tap and it didn't work.
This adds a
pieceInHandtoChessground.state, which holds both the piece, and whether it should overwrite the piece under it when placed. Clicking a piece in the bottom panel populates this property. Clicking anywhere on the board will place the piece and clear thepieceInHandproperty.I'm unsure about the last part, it may be useful to not clear the
pieceInHand, so the user can place all the pieces of a given type and colour at once. But this would also require a button to clear the field, and potentially some UI work to communicate that there is a piece in hand.Lastly, my apologies if this is suboptimally implemented, I'm very new to the codebase and I've scarcely convinced it to build on my machine.