summaryrefslogtreecommitdiffstats
path: root/src/poly.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/poly.js
parentec21f496bddc588e2113fd5418d713ce8ae78f39 (diff)
downloadsvg.js-e567c774c17e6649041d4972defd1232ab602012.tar.gz
svg.js-e567c774c17e6649041d4972defd1232ab602012.zip
Added SVG.Circle, removed structural internal references
Diffstat (limited to 'src/poly.js')
-rwxr-xr-xsrc/poly.js10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/poly.js b/src/poly.js
index 1586c77..2bf0b57 100755
--- a/src/poly.js
+++ b/src/poly.js
@@ -34,13 +34,17 @@ SVG.Polygon = SVG.invent({
SVG.extend(SVG.Polyline, SVG.Polygon, {
// Define morphable array
morphArray: SVG.PointArray
+ // Get array
+, array: function() {
+ return this._array || (this._array = new SVG.PointArray(this.attr('points')))
+ }
// Plot new path
, plot: function(p) {
- return this.attr('points', (this.array = new SVG.PointArray(p, [[0,0]])))
+ return this.attr('points', (this._array = new SVG.PointArray(p)))
}
// Move by left top corner
, move: function(x, y) {
- return this.attr('points', this.array.move(x, y))
+ return this.attr('points', this.array().move(x, y))
}
// Move by left top corner over x-axis
, x: function(x) {
@@ -66,7 +70,7 @@ SVG.extend(SVG.Polyline, SVG.Polygon, {
, size: function(width, height) {
var p = proportionalSize(this.bbox(), width, height)
- return this.attr('points', this.array.size(p.width, p.height))
+ return this.attr('points', this.array().size(p.width, p.height))
}
}) \ No newline at end of file