When I run the sketch below and press and release my actual mouse, I get mousePressed(), then tons of 'true’s until I let go, then mouseReleased(). Great!
But if I do the same thing on the touchscreen, I don’t get mousePressed() until after I release on the screen, and then I get both events, back to back (but never get mousePressed==true). Even while I’m holding the mouse down on the screen, the variable mousePressed never gets set to true.
Drags work as expected with the actual mouse, but on the screen I don’t get any events until I start to drag, and then I get mousePressed(), mousePressed==true, and mouseDragged() (but mosePressed==true only around mouseDragged events).
Is there another way to find out if the mouse has been pressed (and if it is still pressed), even if it’s the mouse/cursor on a touch screen?
public void draw() {
if (mousePressed)
System.out.println("true");
}
public void mousePressed() {
System.out.println("mousePressed()");
}
public void mouseDragged() {
System.out.println("mouseDragged()");
}
public void mouseReleased() {
System.out.println("mouseReleased()");
}