From e338240073332281d649a9a154865a57488c4232 Mon Sep 17 00:00:00 2001 From: HK Date: Fri, 21 Feb 2025 06:30:12 +0530 Subject: [PATCH] Fix: Prevent unnecessary WebGL canvas recreation in noSmooth() in dev-2.0 --- src/shape/attributes.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/shape/attributes.js b/src/shape/attributes.js index 5669c5d32e..334f796bbb 100644 --- a/src/shape/attributes.js +++ b/src/shape/attributes.js @@ -173,7 +173,10 @@ function attributes(p5, fn){ this.drawingContext.imageSmoothingEnabled = false; } } else { - this.setAttributes('antialias', false); + // Only change if necessary to prevent canvas recreation + if (this._renderer.attributes.antialias !== false) { + this.setAttributes('antialias', false); + } } return this; };