diff options
author | wout <wout@impinc.co.uk> | 2014-08-29 12:45:21 +0200 |
---|---|---|
committer | wout <wout@impinc.co.uk> | 2014-08-29 12:45:21 +0200 |
commit | dd4be62e397e4db78444881eed32865f98e52582 (patch) | |
tree | c2300f62c756fde22c80f30aba66dca04602297b /src/transform.js | |
parent | 8789391f036ffded3ac919d62ee652e7cae15c5c (diff) | |
download | svg.js-dd4be62e397e4db78444881eed32865f98e52582.tar.gz svg.js-dd4be62e397e4db78444881eed32865f98e52582.zip |
Added SVG.TBox for transformed bounding boxes
Diffstat (limited to 'src/transform.js')
-rw-r--r-- | src/transform.js | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/transform.js b/src/transform.js index da2bf37..c4f8f70 100644 --- a/src/transform.js +++ b/src/transform.js @@ -26,16 +26,21 @@ SVG.extend(SVG.Element, SVG.FX, { // absolute new SVG.Matrix(o) - // act on rotate + // act on rotation } else if (o.rotation != null) { o.cx = o.cx == null ? target.bbox().cx : o.cx o.cy = o.cy == null ? target.bbox().cy : o.cy - matrix = relative ? - // relative - target.attr('transform', matrix + ' rotate(' + [o.rotation, o.cx, o.cy].join() + ')').ctm() : - // absolute - matrix.rotate(o.rotation - matrix.extract().rotation, o.cx, o.cy) + if (this instanceof SVG.FX) { + o.rotation -= (relative ? 0 : matrix.extract().rotation) + matrix._r = o + } else { + matrix = relative ? + // relative + target.attr('transform', matrix + ' rotate(' + [o.rotation, o.cx, o.cy].join() + ')').ctm() : + // absolute + matrix.rotate(o.rotation - matrix.extract().rotation, o.cx, o.cy) + } // act on scale } else if (o.scale != null || o.scaleX != null || o.scaleY != null) { @@ -86,7 +91,7 @@ SVG.extend(SVG.Element, SVG.FX, { if (o.y != null) matrix.f = o.y } } - + return this.attr('transform', matrix) } }) |