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

mouseButton wierdness in mouseReleased #5733

Closed
1 of 17 tasks
Nisseboy opened this issue Jul 22, 2022 · 1 comment
Closed
1 of 17 tasks

mouseButton wierdness in mouseReleased #5733

Nisseboy opened this issue Jul 22, 2022 · 1 comment

Comments

@Nisseboy
Copy link

Nisseboy commented Jul 22, 2022

Most appropriate sub-area of p5.js?

  • Accessibility (Web Accessibility)
  • Build tools and processes
  • Color
  • Core/Environment/Rendering
  • Data
  • DOM
  • Events
  • Friendly error system
  • Image
  • IO (Input/Output)
  • Localization
  • Math
  • Unit Testing
  • Typography
  • Utilities
  • WebGL
  • Other (specify if possible)

p5.js version

1.4.1

Web browser and version

103.0.5060.134

Operating System

Windows 10

Steps to reproduce this

Steps:

  1. print the value of mouseButton in mouseReleased()
  2. press left and right mouse button then release
  3. check console

It returns two right clicks (or two left) instead of one left and one right

Snippet:

this.focus();
function setup() {
  createCanvas(400, 400);
  window.addEventListener("contextmenu", e => e.preventDefault());
}

function draw() {
  background(220);
  text("push down left and right mouse buttons, then release", 40, 40);
}


function mouseReleased() {
  print(mouseButton);
}
@Nisseboy
Copy link
Author

I fixed the issue by doing this:

function mouseReleased(e) {
  print(e.button);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants