summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorwout <wout@impinc.co.uk>2013-01-12 16:25:24 +0100
committerwout <wout@impinc.co.uk>2013-01-12 16:25:24 +0100
commitd8f4dd3a174fbc72f57240bebeefbda4093fae11 (patch)
treea0cbcee8c12e5b5dc9948c89384145fd3db3316c /src
parent312084aeb01d2b6cdef6b9743aee65973c6f9526 (diff)
downloadsvg.js-d8f4dd3a174fbc72f57240bebeefbda4093fae11.tar.gz
svg.js-d8f4dd3a174fbc72f57240bebeefbda4093fae11.zip
Ensuring polygons and polylines are at position 0,0 within their wrapper
Diffstat (limited to 'src')
-rw-r--r--src/poly.js12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/poly.js b/src/poly.js
index 8867604..978111c 100644
--- a/src/poly.js
+++ b/src/poly.js
@@ -2,7 +2,17 @@ SVG.Poly = {
// Set polygon data with default zero point if no data is passed
plot: function(points) {
- return this.attr('points', points || '0,0');
+ this.attr('points', points || '0,0');
+
+ var box = this.bbox();
+
+ if (box.x != 0 || box.y != 0)
+ this.transform({
+ x: -box.x,
+ y: -box.y
+ });
+
+ return this;
},
// Move path using translate
move: function(x, y) {