summaryrefslogtreecommitdiffstats
path: root/src/sugar.js
diff options
context:
space:
mode:
authorwout <wout@impinc.co.uk>2012-12-22 15:48:35 +0100
committerwout <wout@impinc.co.uk>2012-12-22 15:48:35 +0100
commitca6b0aa77b4ca7a9da616205d4cf0fa108202134 (patch)
tree31781ab304932b27b0f0b00a1ab59db7fcb36769 /src/sugar.js
parentffcc6f4f962652742f1424c6ce9b83d397693853 (diff)
downloadsvg.js-ca6b0aa77b4ca7a9da616205d4cf0fa108202134.tar.gz
svg.js-ca6b0aa77b4ca7a9da616205d4cf0fa108202134.zip
Simplified rotate() syntax
Diffstat (limited to 'src/sugar.js')
-rw-r--r--src/sugar.js13
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);
}
});