summaryrefslogtreecommitdiffstats
path: root/src/line.js
diff options
context:
space:
mode:
authorRémi Tétreault <tetreault.remi@gmail.com>2017-02-17 22:23:51 -0500
committerRémi Tétreault <tetreault.remi@gmail.com>2017-02-17 22:23:51 -0500
commita3c0018d969cc7539c561e9fed2cb1bae679d6cd (patch)
tree148c4334b6c32e4eb35ea8a1012820b9b57fd473 /src/line.js
parent0f21fd2aead7b6c409d0fb36cce55c56e9529a1a (diff)
downloadsvg.js-a3c0018d969cc7539c561e9fed2cb1bae679d6cd.tar.gz
svg.js-a3c0018d969cc7539c561e9fed2cb1bae679d6cd.zip
Make some change to the previous commit
Here is a list of the changes: * Enhance the call to plot in the constructor of SVG.Path, SVG.Line, SVG.Polyline and SVG.Polygon * Rewrite the description of the tests of the method plot for SVG.TextPath, SVG.Path, SVG.Line, SVG.Polyline and SVG.Polygon to make it more precise * Remove the useless parens surrounding track in the method array of SVG.TextPath
Diffstat (limited to 'src/line.js')
-rw-r--r--src/line.js10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/line.js b/src/line.js
index 46ee028..9e8692f 100644
--- a/src/line.js
+++ b/src/line.js
@@ -41,12 +41,12 @@ SVG.Line = SVG.invent({
, construct: {
// Create a line element
line: function(x1, y1, x2, y2) {
- var line = this.put(new SVG.Line)
-
// make sure plot is called as a setter
- return (x1 != null) ?
- line.plot(x1, y1, x2, y2) :
- line.plot([[0,0], [0,0]])
+ // x1 is not necessarily a number, it can also be an array, a string and a SVG.PointArray
+ return SVG.Line.prototype.plot.apply(
+ this.put(new SVG.Line)
+ , x1 != null ? [x1, y1, x2, y2] : [0, 0, 0, 0]
+ )
}
}
})