mouseClicked() won't execute while mouse is in motion

The-IT

So basically the title says it all. I tried searching around; you would think something as trivial as this would have instant results, but nope.

This is really annoying me. Can anyone suggest a fix or workaround? Thanks

Kevin Workman

That's because, by definition, a mouse click while in motion is no longer a mouse click, it's a drag event.

You still have access to the mousePressed() and mouseReleased() events, so if you want to detect a mouse click during a drag event, use those instead.

Here's a small example to get you started:

void mouseClicked(){
  println("clicked");
}

void mousePressed(){
 println("pressed"); 
}

void mouseReleased(){
  println("released");
}

void mouseDragged(){
 println("dragged"); 
}

void draw(){
  background(0);
}

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related