lichess-org / mobile

Lichess mobile app v2
GNU General Public License v3.0
1.29k stars 189 forks source link

Sliding your finger in coordinate trainer continues to select squares #1017

Open EmmetSchuler opened 1 month ago

EmmetSchuler commented 1 month ago

What is the problem?

When using the coordinate trainer, players tap on the square in order to select it. However as of now players can slide their finger around and it will continue to select the square under their finger. This can be confusing, because no other board behaves in this way. I also don't believe this is intended behavior.

Steps to reproduce the bug

Go to coordinate trainer Tap your finger on a square Now continue to drag your finger across the board

Expected: no more inputs are received until you lift your finger up and down again What happened: Inputs are received as long as the finger remains moving

App version

0.11.0

Device Info

Pixel 6 and Android 14

Additional information

No response

sid0-0 commented 4 weeks ago

To fix this issue we'll need to make a change in the lib/src/widgets/board_editor.dart flutter package file since it's code specifies calling the same function on tap and drag actions. Can someone help me with where I will need to make the changes and also publish a new version?

Files for reference:

  1. lib/src/view/coordinate_training/coordinate_training_screen.dart - onGuess method called inside function passed to onEditedSquare on tap/drag.
  2. [user_path]/.pub-cache/hosted/pub.dev/chessground-5.1.1/lib/src/widgets/board_editor.dart - _onTouchedEvent calls onEditedSquare
tom-anders commented 4 weeks ago

You'd need to make a PR at https://github.com/lichess-org/flutter-chessground

Note however, that this behavior is actually intended for the actual board editor (so that you can drag a finger across the board and delete pieces at every location it touches for example).

So probably, the solution would be to add a new field to the EditorPointerMode enum that has the intended behavior

veloce commented 2 days ago

Another way of fixing it is to add an onTappedSquare to the Chessboard widget (and don't use the BoardEditor widget.