Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Prevent unnecessary WebGL canvas recreation in noSmooth() in dev-2.0 #7574

Open
wants to merge 1 commit into
base: dev-2.0
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/shape/attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,10 @@
this.drawingContext.imageSmoothingEnabled = false;
}
} else {
this.setAttributes('antialias', false);
// Only change if necessary to prevent canvas recreation
if (this._renderer.attributes.antialias !== false) {

Check failure on line 177 in src/shape/attributes.js

View workflow job for this annotation

GitHub Actions / test

test/unit/webgl/p5.RendererGL.js > p5.RendererGL > noSmooth() canvas position preservation > should maintain the canvas position after calling noSmooth()

TypeError: Cannot read properties of undefined (reading 'antialias') ❯ fn.noSmooth src/shape/attributes.js:177:37 ❯ <computed> [as noSmooth] src/core/friendly_errors/param_validator.js:535:23 ❯ test/unit/webgl/p5.RendererGL.js:37:12
this.setAttributes('antialias', false);
}
}
return this;
};
Expand Down
Loading