From 9b8426c8b8ca2c34e98600e266ba1cd80f5e877e Mon Sep 17 00:00:00 2001 From: Jules Kris <65314071+jules-kris@users.noreply.github.com> Date: Mon, 28 Oct 2024 14:09:17 -0400 Subject: [PATCH] add OPEN option for endShape make OPEN parameter explicit instead of implied, updated documentation comments, made documentation default parameter match javascript default parameter --- src/core/shape/vertex.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/core/shape/vertex.js b/src/core/shape/vertex.js index 6bdc379d54..1428a8f6e0 100644 --- a/src/core/shape/vertex.js +++ b/src/core/shape/vertex.js @@ -1379,8 +1379,8 @@ p5.prototype.endContour = function() { * beginShape() and `endShape()`. * * @method endShape - * @param {CLOSE} [mode] use CLOSE to close the shape - * @param {Integer} [count] number of times you want to draw/instance the shape (for WebGL mode). + * @param {CLOSE|OPEN} [mode=OPEN] use CLOSE or OPEN to close or open the shape + * @param {Integer} [count=1] number of times you want to draw/instance the shape (for WebGL mode). * @chainable * * @example @@ -1504,7 +1504,7 @@ p5.prototype.endContour = function() { * * */ -p5.prototype.endShape = function(mode, count = 1) { +p5.prototype.endShape = function(mode = constants.OPEN, count = 1) { p5._validateParameters('endShape', arguments); if (count < 1) { console.log('🌸 p5.js says: You can not have less than one instance'); @@ -1532,7 +1532,7 @@ p5.prototype.endShape = function(mode, count = 1) { return this; } - const closeShape = mode === constants.CLOSE; + const closeShape = mode != constants.OPEN; // if the shape is closed, the first element is also the last element if (closeShape && !isContour) {