Trying to figure out the exact event for touch

I have the following event for mousePressed which works great.

function mousePressed(){
    pg.fill(255, 0, 0);
    pg.ellipse(mouseX, mouseY, 20, 20);

    sendmouse(mouseX,mouseY);
}

I'm trying to get the same behavior on a mobile device with touch but I am not seeing the changes as expected on mobile. Here is my function. What am I doing wrong?

function touchStarted() {
  pg.fill(255, 0, 0);
  pg.ellipse(mouseX, mouseY, 20, 20);
  sendmouse(mouseX,mouseY);

  return false;
}

In my setup() I have

pg = createGraphics(578, 400);

Answers

  • post the entire source code. we can't do anything with this.

  • In addition to a minimal full code example (MCVE), could you say a bit more about the problem?

    but I am not seeing the changes as expected on mobile

    What does this mean? Do you mean that nothing at all happens? Or are there multitouch problems? Do events start but not stop? Be more specific.

Sign In or Register to comment.