Skip to content

pmouseX always equal to mouseX #1176

@BarbaraAlmeida

Description

@BarbaraAlmeida

When using p5.js v0.4.20 from December 11, 2015 pmouseX/Y is always equal to mouseX/Y.

I've tried the p5.js files on this issue:

In p5.js v0.4.17 from October 25, 2015 (the one that solved the issue) they are also behaving weirdly: pmouseX/Y is not equal to mouseX/Y when the mouse stops moving (seems to be the same problem reported here) and line(mouseX, mouseY, pmouseX, pmouseY); produces a dashed line.

It seems to work fine with p5.js v0.4.17 from October 13, 2015.

Code:

function setup() {
  createCanvas(500, 500);
  background(240);
}


function draw() {  
  line(mouseX, mouseY, pmouseX, pmouseY);

  fill(255);
  rect(0, 0, 300, 50);

  fill(0);
  text("mouseX = " + mouseX, 30, 20);
  text("pmouseX = " + pmouseX, 30, 35);

  text("mouseY = " + mouseY, 180, 20);
  text("pmouseY = " + pmouseY, 180, 35);

  if (mouseX == pmouseX) {
    ellipse(10, 20, 10, 10);
  }

   if (mouseX == pmouseX) {
    ellipse(160, 20, 10, 10);
  }
}


function mousePressed() {
  background(240);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions