File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ var isBezier = false;
1717var isCurve = false ;
1818var isQuadratic = false ;
1919var 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
You can’t perform that action at this time.
0 commit comments