diff options
author | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2017-02-19 15:30:50 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-19 15:30:50 +0100 |
commit | 79a1547788c01273df922371b73253f4c97c1b8f (patch) | |
tree | 148c4334b6c32e4eb35ea8a1012820b9b57fd473 /src/poly.js | |
parent | 0f1649e7e3179f8c95058daffdbfb62133483f0e (diff) | |
parent | a3c0018d969cc7539c561e9fed2cb1bae679d6cd (diff) | |
download | svg.js-79a1547788c01273df922371b73253f4c97c1b8f.tar.gz svg.js-79a1547788c01273df922371b73253f4c97c1b8f.zip |
Merge pull request #589 from RmiTtro/sort-leftovers-from-old-fx
Sort out leftovers from the old fx module
Diffstat (limited to 'src/poly.js')
-rw-r--r-- | src/poly.js | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/poly.js b/src/poly.js index 26ca603..af1f075 100644 --- a/src/poly.js +++ b/src/poly.js @@ -4,12 +4,13 @@ SVG.Polyline = SVG.invent({ // Inherit from , inherit: SVG.Shape - + // Add parent method , construct: { // Create a wrapped polyline element polyline: function(p) { - return this.put(new SVG.Polyline).plot(p) + // make sure plot is called as a setter + return this.put(new SVG.Polyline).plot(p || new SVG.PointArray) } } }) @@ -20,12 +21,13 @@ SVG.Polygon = SVG.invent({ // Inherit from , inherit: SVG.Shape - + // Add parent method , construct: { // Create a wrapped polygon element polygon: function(p) { - return this.put(new SVG.Polygon).plot(p) + // make sure plot is called as a setter + return this.put(new SVG.Polygon).plot(p || new SVG.PointArray) } } }) @@ -38,7 +40,9 @@ SVG.extend(SVG.Polyline, SVG.Polygon, { } // Plot new path , plot: function(p) { - return this.attr('points', (this._array = new SVG.PointArray(p))) + return (p == null) ? + this.array() : + this.attr('points', (this._array = new SVG.PointArray(p))) } // Move by left top corner , move: function(x, y) { @@ -51,4 +55,4 @@ SVG.extend(SVG.Polyline, SVG.Polygon, { return this.attr('points', this.array().size(p.width, p.height)) } -})
\ No newline at end of file +}) |