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/path.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/path.js')
-rw-r--r-- | src/path.js | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/path.js b/src/path.js index f49e950..0c70a47 100644 --- a/src/path.js +++ b/src/path.js @@ -15,7 +15,9 @@ SVG.Path = SVG.invent({ } // Plot new poly points , plot: function(p) { - return this.attr('d', (this._array = new SVG.PathArray(p))) + return (p == null) ? + this.array() : + this.attr('d', (this._array = new SVG.PathArray(p))) } // Move by left top corner , move: function(x, y) { @@ -32,7 +34,7 @@ SVG.Path = SVG.invent({ // Set element size to given width and height , size: function(width, height) { var p = proportionalSize(this, width, height) - + return this.attr('d', this.array().size(p.width, p.height)) } // Set width of element @@ -43,14 +45,15 @@ SVG.Path = SVG.invent({ , height: function(height) { return height == null ? this.bbox().height : this.size(this.bbox().width, height) } - + } - + // Add parent method , construct: { // Create a wrapped path element path: function(d) { - return this.put(new SVG.Path).plot(d) + // make sure plot is called as a setter + return this.put(new SVG.Path).plot(d || new SVG.PathArray) } } -})
\ No newline at end of file +}) |