summaryrefslogtreecommitdiffstats
path: root/src/sugar.js
diff options
context:
space:
mode:
authorSaivan <savian@me.com>2018-02-26 19:21:18 +1100
committerSaivan <savian@me.com>2018-02-26 19:21:18 +1100
commit632e0cc50b383a74052321aa661c0ed2d6820f34 (patch)
treed6c724deebf5225035c57065a8fbf2273f0b8bf6 /src/sugar.js
parent9f5d88672a62ab1eef42bf481d38787562363e7d (diff)
downloadsvg.js-632e0cc50b383a74052321aa661c0ed2d6820f34.tar.gz
svg.js-632e0cc50b383a74052321aa661c0ed2d6820f34.zip
Matrix operations now apply to the current matrix
This commit applies matrix operations to the current matrix, so calling mat.rotate will rotate the current matrix directly
Diffstat (limited to 'src/sugar.js')
-rw-r--r--src/sugar.js10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/sugar.js b/src/sugar.js
index 117acea..838592c 100644
--- a/src/sugar.js
+++ b/src/sugar.js
@@ -32,13 +32,15 @@ var sugar = {
SVG.extend([SVG.Element, SVG.FX], {
// Map rotation to transform
- rotate: function(d, cx, cy) {
+, rotate: function(angle, cx, cy) {
+ var matrix = new SVG.Matrix().rotate(angle, cx, cy)
+
return this.transform({ rotation: d, cx: cx, cy: cy })
}
// Map skew to transform
, skew: function(x, y, cx, cy) {
return arguments.length == 1 || arguments.length == 3 ?
- this.transform({ skew: x, cx: y, cy: cx }) :
+ this.transform({ skew: x, cx: y, cy: cx }) :
this.transform({ skewX: x, skewY: y, cx: cx, cy: cy })
}
// Map scale to transform
@@ -56,10 +58,6 @@ SVG.extend([SVG.Element, SVG.FX], {
o = typeof a == 'number' ? a : o
return this.transform({ flip: a || 'both', offset: o })
}
- // Map matrix to transform
-, matrix: function(m) {
- return this.attr('transform', new SVG.Matrix(arguments.length == 6 ? [].slice.call(arguments) : m))
- }
// Opacity
, opacity: function(value) {
return this.attr('opacity', value)