diff options
author | wout <wout@impinc.co.uk> | 2013-03-02 17:31:46 +0100 |
---|---|---|
committer | wout <wout@impinc.co.uk> | 2013-03-02 17:31:46 +0100 |
commit | ca15876e17a1acce4909837af97d97995d0f5b23 (patch) | |
tree | 12d4646b807fac8d4398f0902c2c5fc8196f49d0 /src/sugar.js | |
parent | 028bf91551d01567b4cb3d971ba51fa57c4a81ef (diff) | |
download | svg.js-ca15876e17a1acce4909837af97d97995d0f5b23.tar.gz svg.js-ca15876e17a1acce4909837af97d97995d0f5b23.zip |
Improved rotate() method in sugar module
Diffstat (limited to 'src/sugar.js')
-rw-r--r-- | src/sugar.js | 35 |
1 files changed, 12 insertions, 23 deletions
diff --git a/src/sugar.js b/src/sugar.js index e076491..42883e5 100644 --- a/src/sugar.js +++ b/src/sugar.js @@ -33,27 +33,29 @@ var _colorPrefix = function(type, attr) { if (module) { SVG.extend(module, { // Rotation - rotate: function(angle) { + rotate: function(deg, cx, cy) { return this.transform({ - rotation: angle || 0 + rotation: deg || 0 + , cx: cx + , cy: cy }) - }, + } // Skew - skew: function(x, y) { + , skew: function(x, y) { return this.transform({ - skewX: x || 0, - skewY: y || 0 + skewX: x || 0 + , skewY: y || 0 }) - }, + } // Scale - scale: function(x, y) { + , scale: function(x, y) { return this.transform({ scaleX: x, scaleY: y == null ? x : y }) - }, + } // Opacity - opacity: function(value) { + , opacity: function(value) { return this.attr('opacity', value) } @@ -61,19 +63,6 @@ var _colorPrefix = function(type, attr) { } }) -if (SVG.G) { - SVG.extend(SVG.G, { - // Move using translate - move: function(x, y) { - return this.transform({ - x: x, - y: y - }) - } - - }) -} - if (SVG.Text) { SVG.extend(SVG.Text, { // Set font |