Skip to content

Do not update the square all the time while panning#81

Merged
veloce merged 2 commits intolichess-org:mainfrom
HaonRekcef:improve-editor
Oct 1, 2025
Merged

Do not update the square all the time while panning#81
veloce merged 2 commits intolichess-org:mainfrom
HaonRekcef:improve-editor

Conversation

@HaonRekcef
Copy link
Contributor

This change is needed for lichess-org/mobile#2213
This will allow users to delete a piece by pressing the square again.

@veloce
Copy link
Collaborator

veloce commented Sep 21, 2025

Not sure about the consequences of that one. Panning is also needed for the editor so we can add same piece by panning to multiple square during same gesture. We don't want to remove that ability.

@HaonRekcef
Copy link
Contributor Author

HaonRekcef commented Sep 22, 2025

I should have been more clear. This is exactly why we need these changes to chessground and lichess-org/mobile#2213 is not sufficient. Here a video recording:

board_editor.webm

One possible issue with this implementation is that if you go over a square twice while panning, it will remove the piece again. This could be fixed, but at the same time panning is not that useful anyway, since in normal chess there are at most 8 of the same piece on the board.

@veloce
Copy link
Collaborator

veloce commented Sep 22, 2025

Useful for the pawns. I think it is fine like that, but will look at it in more detail. Thanks!

Copy link
Collaborator

@veloce veloce left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we could add a simple test here to show effect of the change.

@HaonRekcef
Copy link
Contributor Author

Added onPanCancel, good catch.
Not really sure what to test, the only thing that changed is that while panning onEditedSquare is only called once per square. I have included a test case in the lichess-org/mobile#2213 PR though.

@veloce veloce merged commit b5d60b3 into lichess-org:main Oct 1, 2025
1 check passed
@HaonRekcef HaonRekcef deleted the improve-editor branch October 30, 2025 21:36
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.

2 participants