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

add OPEN option for endShape #7336

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
8 changes: 4 additions & 4 deletions src/core/shape/vertex.js
Original file line number Diff line number Diff line change
Expand Up @@ -1379,8 +1379,8 @@ p5.prototype.endContour = function() {
* <a href="#/p5/beginShape">beginShape()</a> 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
Expand Down Expand Up @@ -1504,7 +1504,7 @@ p5.prototype.endContour = function() {
* </code>
* </div>
*/
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');
Expand Down Expand Up @@ -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) {
Expand Down
Loading