diff options
author | Rémi Tétreault <tetreault.remi@gmail.com> | 2017-02-16 20:35:05 -0500 |
---|---|---|
committer | Rémi Tétreault <tetreault.remi@gmail.com> | 2017-02-16 21:36:35 -0500 |
commit | 0f21fd2aead7b6c409d0fb36cce55c56e9529a1a (patch) | |
tree | ada98d3503862f2a36b0d46615ceb89100daa784 /src/path.js | |
parent | 0f1649e7e3179f8c95058daffdbfb62133483f0e (diff) | |
download | svg.js-0f21fd2aead7b6c409d0fb36cce55c56e9529a1a.tar.gz svg.js-0f21fd2aead7b6c409d0fb36cce55c56e9529a1a.zip |
Sort out leftovers from the old fx module
This commit is mostly to clean up the implementation of the initAnimation
method of the Fx Module (issue #547). It also fixes these issues: #552, #582
and #584.
Here is a list of the changes and fixes that are made:
* Add a plot and array method to SVG.TextPath (issue #582)
* Make the method plot a getter when no parameter is passed for SVG.Polyline,
SVG.Polygon, SVG.Line, SVG.Path (this idea come from issue #547)
* Allow SVG.PointArray to be passed flat array
* Change the regexp SVG.PointArray use to parse string to allow more
flexibility in the way spaces and commas can be used to separate points
(something like this is now accepted: '1, 2, 3, 4')
* Allow plot to be called with 4 parameters when animating an SVG.Line
* Fix a bug in the plain morphing part of SVG.MorphObj that is in the FX module
* Relative value for SVG.Number are now calculated in its morph method (idea
from issue #547)
* Clean up the implementation of the initAnimation method of the FX module
(issues #547, #552, #584)
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..55ac5fd 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 != null ? d : new SVG.PathArray) } } -})
\ No newline at end of file +}) |