diff options
author | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2016-11-10 15:15:58 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-10 15:15:58 +0100 |
commit | f80cd95ee9a086ce04c1a184ffa6a4c9429c4975 (patch) | |
tree | 47f23aacc47d8825298fd1f9ff9ae7381166322a /src/transform.js | |
parent | 8b24eb02ded49b77f04cb7b5214c224569fc841b (diff) | |
parent | 1a32907588436496d70ffd4b19d55e1325cdf5ba (diff) | |
download | svg.js-f80cd95ee9a086ce04c1a184ffa6a4c9429c4975.tar.gz svg.js-f80cd95ee9a086ce04c1a184ffa6a4c9429c4975.zip |
Merge pull request #548 from RmiTtro/fix-transform-anim
Make transform more consistent when animated. Fixes bug with animated matrices
Diffstat (limited to 'src/transform.js')
-rw-r--r-- | src/transform.js | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/transform.js b/src/transform.js index 1635152..33f5019 100644 --- a/src/transform.js +++ b/src/transform.js @@ -58,13 +58,13 @@ SVG.extend(SVG.Element, { matrix = matrix.scale(o.scaleX, o.scaleY, o.cx, o.cy) // act on skew - } else if (o.skewX != null || o.skewY != null) { + } else if (o.skew != null || o.skewX != null || o.skewY != null) { // ensure centre point ensureCentre(o, target) // ensure skew values on both axes - o.skewX = o.skewX != null ? o.skewX : 0 - o.skewY = o.skewY != null ? o.skewY : 0 + o.skewX = o.skew != null ? o.skew : o.skewX != null ? o.skewX : 0 + o.skewY = o.skew != null ? o.skew : o.skewY != null ? o.skewY : 0 if (!relative) { // absolute; reset skew values @@ -267,6 +267,12 @@ SVG.Transformation = SVG.invent({ o[this.arguments[i]] = typeof this[this.arguments[i]] == 'undefined' ? 0 : o[this.arguments[i]] } + // The method SVG.Matrix.extract which was used before calling this + // method to obtain a value for the parameter o doesn't return a cx and + // a cy so we use the ones that were provided to this object at its creation + o.cx = this.cx + o.cy = this.cy + this._undo = new SVG[capitalize(this.method)](o, true).at(1) return this |