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

Arrow doesn't snap to valid move after mouse re-enters DOM #280

Closed
ch-iv opened this issue Aug 9, 2023 · 1 comment
Closed

Arrow doesn't snap to valid move after mouse re-enters DOM #280

ch-iv opened this issue Aug 9, 2023 · 1 comment

Comments

@ch-iv
Copy link

ch-iv commented Aug 9, 2023

When an arrow is drawn, by default it should snap to a valid move. However after the mouse leaves the board DOM and then re-enters, the arrow stops snapping to a valid move. This is caused by the following code in the processDraw function of draw.ts.

if (!keyAtDomPos) {
  cur.snapToValidMove = false;
}

I think originally this was meant to completely prevent the arrow from being drawn when mouse leaves the DOM, but the state of cur.snapToValidMove does not get set to the original value after the mouse re-enters the DOM. If this behavior is not intentional, I suggest the following fix:

cur.snapToValidMove = keyAtDomPos ? false : state.drawable.defaultSnapToValidMove;

If this is confirmed to be a bug, I'll be happy to create a pull request.

@niklasf
Copy link
Member

niklasf commented Aug 9, 2023

Hi. This is actually a weird but useful feature (#147).

@niklasf niklasf closed this as completed Aug 9, 2023
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

No branches or pull requests

2 participants