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

Piece Sticks to Mouse When Dragged and Clicked outside the Chessboard #8

Open
prrockzed opened this issue Nov 16, 2024 · 3 comments
Open
Labels
Moderate Level Issue Requires some information about the project

Comments

@prrockzed
Copy link
Owner

Describe the bug

When a piece is selected and dragged outside the chessboard (though the piece doesn't actually go outside), if the mouse is clicked anywhere outside the chessboard and then moved back inside, the piece remains attached to the mouse. When clicked anywhere on the chessboard, the piece is dropped at that position, regardless of whether the move is legal or not. The piece should return to its original position if the mouse is clicked outside the chessboard.

To Reproduce

Steps to reproduce the behavior:

  1. Select a piece.
  2. Drag the piece outside the chessboard (without letting go of the mouse).
  3. Click anywhere outside the chessboard.
  4. Move the mouse back inside the chessboard.
  5. Click anywhere on the chessboard to drop the piece (even in an illegal position).

Expected behavior

The piece should not remain attached to the mouse once clicked outside the chessboard. If the mouse is clicked outside the chessboard, the piece should return to its original position, and no piece should be able to be dropped unless it’s a legal move.

Screenshots

Chess bug

Additional context

This issue could be resolved by implementing a separate logic to reset the piece's position when the mouse click occurs outside the chessboard area. Let me know if you’d like to discuss the specifics of implementing this logic before proceeding.

@prrockzed prrockzed added the Moderate Level Issue Requires some information about the project label Nov 16, 2024
@dipamsen
Copy link
Contributor

dipamsen commented Nov 22, 2024

This issue could be resolved by implementing a separate logic to reset the piece's position when the mouse click occurs outside the chessboard area.

Alternatively, wouldn't an easier option be to just bind the mouse events on the entire body rather than the chessboard element?

@prrockzed
Copy link
Owner Author

Yeah, that is better. If you want to work on it, go ahead.

@Bishal-35
Copy link

Hey @prrockzed I would like to work on it under SWoC'25. Please assign me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Moderate Level Issue Requires some information about the project
Projects
None yet
Development

No branches or pull requests

3 participants