summaryrefslogtreecommitdiffstats
path: root/src/sugar.js
diff options
context:
space:
mode:
authorwout <wout@impinc.co.uk>2014-07-11 23:36:17 +0200
committerwout <wout@impinc.co.uk>2014-07-11 23:36:17 +0200
commit462d2cd3738c904db0be7086878d1fcc17b79553 (patch)
treeafabf22b2f46e5432dc0d56219872f590eb19892 /src/sugar.js
parent7cc2d3635b8ed513e0f4e5be0a1823c1a6ad93dc (diff)
downloadsvg.js-462d2cd3738c904db0be7086878d1fcc17b79553.tar.gz
svg.js-462d2cd3738c904db0be7086878d1fcc17b79553.zip
Completely reworked transform system
Diffstat (limited to 'src/sugar.js')
-rwxr-xr-xsrc/sugar.js27
1 files changed, 7 insertions, 20 deletions
diff --git a/src/sugar.js b/src/sugar.js
index 493c6c7..e759812 100755
--- a/src/sugar.js
+++ b/src/sugar.js
@@ -30,37 +30,24 @@ var sugar = {
SVG.extend(SVG.Element, SVG.FX, {
// Rotation
- rotate: function(deg, x, y) {
- return this.transform({
- rotation: deg || 0
- , cx: x
- , cy: y
- })
+ rotate: function(d, cx, cy) {
+ return this.transform({ rotation: d, cx: cx, cy: cy })
}
// Skew
, skew: function(x, y) {
- return this.transform({
- skewX: x || 0
- , skewY: y || 0
- })
+ return this.transform({ skewX: x, skewY: y })
}
// Scale
-, scale: function(x, y) {
- return this.transform({
- scaleX: x
- , scaleY: y == null ? x : y
- })
+, scale: function(x, y, cx, cy) {
+ return this.transform({ scaleX: x, scaleY: y, cx: cx, cy: cy })
}
// Translate
, translate: function(x, y) {
- return this.transform({
- x: x
- , y: y
- })
+ return this.transform({ x: x, y: y })
}
// Matrix
, matrix: function(m) {
- return this.transform({ matrix: m })
+ return this.attr('transform', new SVG.Matrix(m))
}
// Opacity
, opacity: function(value) {