summaryrefslogtreecommitdiffstats
path: root/src/path.js
diff options
context:
space:
mode:
authorwout <wout@impinc.co.uk>2014-06-25 15:05:03 +0200
committerwout <wout@impinc.co.uk>2014-06-25 15:05:03 +0200
commite567c774c17e6649041d4972defd1232ab602012 (patch)
tree05140fe4715a652c99f15672e1d56c0fc8426824 /src/path.js
parentec21f496bddc588e2113fd5418d713ce8ae78f39 (diff)
downloadsvg.js-e567c774c17e6649041d4972defd1232ab602012.tar.gz
svg.js-e567c774c17e6649041d4972defd1232ab602012.zip
Added SVG.Circle, removed structural internal references
Diffstat (limited to 'src/path.js')
-rwxr-xr-xsrc/path.js14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/path.js b/src/path.js
index 773b3d8..8282ce7 100755
--- a/src/path.js
+++ b/src/path.js
@@ -7,13 +7,19 @@ SVG.Path = SVG.invent({
// Add class methods
, extend: {
+ // Define morphable array
+ morphArray: SVG.PathArray
+ // Get array
+ , array: function() {
+ return this._array || (this._array = new SVG.PathArray(this.attr('d')))
+ }
// Plot new poly points
- plot: function(p) {
- return this.attr('d', (this.array = new SVG.PathArray(p, [['M', 0, 0]])))
+ , plot: function(p) {
+ return this.attr('d', (this._array = new SVG.PathArray(p)))
}
// Move by left top corner
, move: function(x, y) {
- return this.attr('d', this.array.move(x, y))
+ return this.attr('d', this.array().move(x, y))
}
// Move by left top corner over x-axis
, x: function(x) {
@@ -27,7 +33,7 @@ SVG.Path = SVG.invent({
, size: function(width, height) {
var p = proportionalSize(this.bbox(), width, height)
- return this.attr('d', this.array.size(p.width, p.height))
+ return this.attr('d', this.array().size(p.width, p.height))
}
// Set width of element
, width: function(width) {