diff options
author | wout <wout@impinc.co.uk> | 2012-12-22 15:48:35 +0100 |
---|---|---|
committer | wout <wout@impinc.co.uk> | 2012-12-22 15:48:35 +0100 |
commit | ca6b0aa77b4ca7a9da616205d4cf0fa108202134 (patch) | |
tree | 31781ab304932b27b0f0b00a1ab59db7fcb36769 /src/sugar.js | |
parent | ffcc6f4f962652742f1424c6ce9b83d397693853 (diff) | |
download | svg.js-ca6b0aa77b4ca7a9da616205d4cf0fa108202134.tar.gz svg.js-ca6b0aa77b4ca7a9da616205d4cf0fa108202134.zip |
Simplified rotate() syntax
Diffstat (limited to 'src/sugar.js')
-rw-r--r-- | src/sugar.js | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/sugar.js b/src/sugar.js index b9ac577..eba897d 100644 --- a/src/sugar.js +++ b/src/sugar.js @@ -36,10 +36,15 @@ SVG.extend(SVG.Element, { rotate: function(o) { var b = this.bbox(); - if (o.x == null) o.x = b.cx; - if (o.y == null) o.y = b.cy; - - return this.transform('rotate(' + (o.deg || 0) + ' ' + o.x + ' ' + o.y + ')', o.relative); + if (typeof o == 'number') + o = { deg: o }; + + return this.transform( + 'rotate(' + + (o.deg || 0) + ' ' + + (o.x == null ? b.cx : o.x) + ' ' + + (o.y == null ? b.cx : o.y) + ')', + o.relative); } }); |