-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Description
Most appropriate sub-area of p5.js?
- Accessibility
- Color
- Core/Environment/Rendering
- Data
- DOM
- Events
- Image
- IO
- Math
- Typography
- Utilities
- WebGL
- Build process
- Unit testing
- Internationalization
- Friendly errors
- Other (specify if possible)
p5.js version
1.9.0
Web browser and version
122.0.6261.95 (Official Build) (64-bit) (cohort: Stable)
Operating system
Windows 10 Home Edition
Steps to reproduce this
Steps:
- Press and hold left mouse button
- Press and hold right mouse button
- Release left mouse button
- Expected: console logs
left - Actual: console logs
right
- Expected: console logs
Snippet:
function setup() {
createCanvas(400, 400);
}
function mouseReleased() {
console.log(mouseButton);
}
function draw() {
background(220);
}Additional Context
I discovered this issue when implementing the game of Minesweeper. In that game, pressing and releasing both mouse buttons at the same time is the way to uncover all unmarked neighbors of a cell, and I found that I could not detect this condition reliably using mouseButton. I believe this is due to mouseButton being updated in mousePressed but not mouseReleased.
https://github.com/processing/p5.js/blob/main/src/events/mouse.js#L657
https://github.com/processing/p5.js/blob/main/src/events/mouse.js#L733
I have a pull request (with associated unit test) that appears to resolve the issue. This bug was previously reported in #5733, but the submitter resolved that issue as they found a workaround.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status