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.51k stars 3.29k forks source link

p5.Framebuffer.autoSized() method may be broken #6998

Closed nickmcintyre closed 4 months ago

nickmcintyre commented 5 months ago

Most appropriate sub-area of p5.js?

p5.js version

1.9.3

Web browser and version

Chrome 124.0.6367.91

Operating system

macOS 14.4.1

Steps to reproduce this

Steps:

  1. Call myBuffer.autoSized()
  2. Get TypeError: myBuffer.autoSized is not a function.

Here's the full sketch.

My first guess is that there's a name collision between the autoSized() method and the property which is a Boolean. Here's the implementation for reference:

autoSized(autoSized) {
  if (autoSized === undefined) {
    return this.autoSized;
  } else {
    this.autoSized = autoSized;
    this._handleResize();
  }
}
davepagurek commented 4 months ago

Good catch @nickmcintyre! I think that is indeed the cause. I'll rename the internal variable to remove the clash.