Skip to content

Commit ad57997

Browse files
author
Lauren McCarthy
committed
fixes #1362
1 parent e37cc46 commit ad57997

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/core/vertex.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ var isBezier = false;
1717
var isCurve = false;
1818
var isQuadratic = false;
1919
var isContour = false;
20+
var isFirstContour = true;
2021

2122
/**
2223
* Use the beginContour() and endContour() functions to create negative
@@ -389,7 +390,12 @@ p5.prototype.endContour = function() {
389390
vert.moveTo = false;
390391
contourVertices.push(vert);
391392

392-
vertices.push(vertices[0]);
393+
// prevent stay lines with multiple contours
394+
if (isFirstContour) {
395+
vertices.push(vertices[0]);
396+
isFirstContour = false;
397+
}
398+
393399
for (var i = 0; i < contourVertices.length; i++) {
394400
vertices.push(contourVertices[i]);
395401
}
@@ -447,6 +453,7 @@ p5.prototype.endShape = function(mode) {
447453
isBezier = false;
448454
isQuadratic = false;
449455
isContour = false;
456+
isFirstContour = true;
450457

451458
// If the shape is closed, the first element was added as last element.
452459
// We must remove it again to prevent the list of vertices from growing

0 commit comments

Comments
 (0)