chessground icon indicating copy to clipboard operation
chessground copied to clipboard

Clear shapes patches

Open johndoknjas opened this issue 2 months ago • 2 comments

This PR does the following:

  • Renames the 'erase' property (again).
  • If said property is true, ensure the behaviour doesn't change. For example, in a live game, a mouchdown anywhere will clear all drawings.
  • Otherwise, clear arrows if the user clicks on a non-movable square, and then drags by a distance of at least 15px. This increases the requirement from the original PR, where all drawings would be cleared on any position change.

An outstanding concern of mine is whether clicking off the board and then back on it works properly. From personal experience yesterday, I noticed this was a bit glitchy. E.g., I think I had clicked off the board, and then after trying to click back on it a few times, the ctrl-z function (to clear drawings) didn't work. I'm not sure if anyone has insight into whether this PR would affect this, but just wanted to mention it.

If we merge this, we should probably close all issues made in chessground and lila, so that in case anyone still experiences bugs, they don't feel they'd be making a duplicate issue.

johndoknjas avatar Oct 18 '25 02:10 johndoknjas

Excuse me, but can you remind exactly what use case this improves?

I added a test board to experiment with it.

I think it works? But I don't understand why it's useful. I only found it more confusing, and harder to predict if a click or a drag will clear the shapes or not.

ornicar avatar Oct 22 '25 06:10 ornicar

@ornicar Two main use cases I had in mind:

  • If the user is drawing arrows on a computer with their trackpad. I teach chess using lichess studies, and it's not uncommon for me to try to draw an arrow but to inadvertently left click and clear all the drawings. At time this happens repeatedly for some reason.
  • On a phone, any touch on the board (e.g., if the user's trying to scroll down or back up) erases all arrows, and then there's not even an option to ctrl+z it atm. Earlier this month I had to use my phone to review some openings before a tournament game, and I probably cleared around a dozen positions.

If the user's on a computer using a mouse though, I agree there're essentially no benefits.

johndoknjas avatar Oct 22 '25 09:10 johndoknjas