From cdbccb63dc49e4fcf7a2ea4d3d7538fb2b12dc87 Mon Sep 17 00:00:00 2001 From: HK Date: Mon, 17 Feb 2025 06:23:53 +0530 Subject: [PATCH] Fix: prevent unnecessary webgl canvas recreation in noSmooth() --- src/core/shape/attributes.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/core/shape/attributes.js b/src/core/shape/attributes.js index b88ab13afd..210d54271d 100644 --- a/src/core/shape/attributes.js +++ b/src/core/shape/attributes.js @@ -176,7 +176,10 @@ p5.prototype.noSmooth = function() { 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; };