processing / p5.js

p5.js is a client-side JS platform that empowers artists, designers, students, and anyone to learn to code and express themselves creatively on the web. It is based on the core principles of Processing. http://twitter.com/p5xjs β€”
http://p5js.org/
GNU Lesser General Public License v2.1
21.6k stars 3.31k forks source link

Mostly offscreen primitive shapes throws error #7259

Open mimiyin opened 1 month ago

mimiyin commented 1 month ago

Most appropriate sub-area of p5.js?

p5.js version

1.8.0+

Web browser and version

128.0.6613.86 (Official Build) (x86_64)

Operating system

MacOSX

Steps to reproduce this

Steps:

  1. Draw ellipse(400, 400, 400,400);

  2. Change the y-coordinate to 440

  3. Error

  4. Draw ellipse(400, 0, 400,400);

  5. Change the y-coordinate to -1

  6. Error

I was not able to repro with changes to the x-coordinate I was able to repro with line() and rect(). Errors go away with pre 1.8 versions.

Error: TypeError: Cannot read properties of undefined (reading '9') at undefined:52576:53

🌸 p5.js says: [p5.js, line 52576] Cannot read property of undefined. Check the line number in error and make sure the variable which is being operated is not undefined.

Snippet:

function setup() {
  createCanvas(400, 400);
}

function draw() {
  background(220);

  // No-Error
  ellipse(400, 0, 400,400);

//   // Error
//   ellipse(400, -1, 400,400);

//   // No-Error
//   ellipse(400, 400, 400,400);

//   // Error
//   ellipse(400, 440, 400,400);
}
mimiyin commented 1 month ago

I can no longer reproduce this issue.

michaelo commented 4 days ago

Just a FYI that I may have identified the step required to reproduce the issue:

It seems to me that a key factor to trigger the error is to enable accessible output (ctrl+shift+1 to enable, ctrl+shit+2 to disable on Windows, replace "ctrl" with "cmd" for macOS).

https://github.com/processing/p5.js-web-editor/issues/3243#issuecomment-2416112003