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

If using a mouse, handle piece dragging like lichess web. #59

Merged
merged 1 commit into from
Nov 19, 2024

Conversation

safraser
Copy link
Contributor

Currently when dragging a piece by touch there is a large circular shadow showing the target square and the dragged piece is offset so everything is visible despite the finger in the way. However if a mouse is used either on a tablet or in a desktop app this looks strange.

This PR makes the behaviour closer to normal chess applications when using the mouse but keeping the same behaviour for touch screens, specifically:

  • the dragged piece follows the cursor
  • instead of a large circle, the target square is highlighted.

This could be further refined by making only legal target squares be highlighted.

@veloce
Copy link
Collaborator

veloce commented Nov 14, 2024

Thanks for this initiative!

This PR is missing the tests for this new feature. All the logic in this package should be tested, because it is very important for a chess app. Right now there is no test for the shadow circle when dragging a piece, I believe. This is the opportunity to add one and add tests for the mouse too.

@safraser
Copy link
Contributor Author

I'm a bit busy in the immediate future but will look into adding the tests. I'm not that familiar with flutter at the moment so it will likely take me a bit of time anyway.

@veloce veloce merged commit b6b075b into lichess-org:main Nov 19, 2024
1 check passed
@veloce
Copy link
Collaborator

veloce commented Nov 19, 2024

Actually, I used your code and added some more logic so we can also have this behaviour in touch devices for those who want to.

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