diff --git a/src/core/graphics/Graphics.js b/src/core/graphics/Graphics.js index d9ceae8..96ffd84 100644 --- a/src/core/graphics/Graphics.js +++ b/src/core/graphics/Graphics.js @@ -217,7 +217,9 @@ if (this.currentPath.shape.points.length) { // halfway through a line? start a new one! - this.drawShape( new math.Polygon( this.currentPath.shape.points.slice(-2) )); + var shape = new math.Polygon(this.currentPath.shape.points.slice(-2)); + shape.closed = false; + this.drawShape(shape); } else { @@ -240,7 +242,9 @@ */ Graphics.prototype.moveTo = function (x, y) { - this.drawShape(new math.Polygon([x,y])); + var shape = new math.Polygon([x,y]); + shape.closed = false; + this.drawShape(shape); return this; }; @@ -650,6 +654,14 @@ // see section 3.1: https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#3-managing-arguments var points = path; + var closed = true; + + if (points instanceof math.Polygon) + { + closed = points.closed; + points = points.points; + } + if (!Array.isArray(points)) { // prevents an argument leak deopt @@ -662,7 +674,10 @@ } } - this.drawShape(new math.Polygon(points)); + var shape = new math.Polygon(points); + shape.closed = closed; + + this.drawShape(shape); return this; };