processing/p5.js

p5.Framebuffer.autoSized() method may be broken

nickmcintyre opened this issue · 1 comments

Most appropriate sub-area of p5.js?

  • Accessibility
  • Color
  • Core/Environment/Rendering
  • Data
  • DOM
  • Events
  • Image
  • IO
  • Math
  • Typography
  • Utilities
  • WebGL
  • Build process
  • Unit testing
  • Internationalization
  • Friendly errors
  • Other (specify if possible)

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();
  }
}

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