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

Unexpected mouseConstraint behavior on mouse leaving end re-entering p5 canvas creates #1327

Open
alexf77 opened this issue Jan 7, 2025 · 0 comments

Comments

@alexf77
Copy link

alexf77 commented Jan 7, 2025

Using p5 for rendering, I discovered a weird behavior:

Screen.Recording.2025-01-03.at.10.00.31.mov
  • clicking and dragging a body
  • mouse leaves canvas without releasing button
  • body is detached from mouse and falls as expected
  • while mouse is outside canvas, button is released
  • mouse reenters canvas
  • when mouse is hovering over the previously dragged body, the body becomes attached to mouse
  • on mousedown it is released

I found this solution with the help of Copilot:

canvas.elt.addEventListener("mouseout", () => {
    canvasMouse.button = -1;
  });

for a newbie like me it would be helpful if this were mentioned in the docs, or perhaps even default behavior

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

1 participant