diff options
author | wout <wout@impinc.co.uk> | 2014-07-12 14:18:52 +0200 |
---|---|---|
committer | wout <wout@impinc.co.uk> | 2014-07-12 14:18:52 +0200 |
commit | 0f74fe7d0a2fb1c02c5beebf5f0f8360020f1fc1 (patch) | |
tree | 82bdcd06a6d581414ebf7e5ec472c587bdc77bd7 /src/matrix.js | |
parent | 501cb5387007a89af382717376c773a1ec6b68ae (diff) | |
download | svg.js-0f74fe7d0a2fb1c02c5beebf5f0f8360020f1fc1.tar.gz svg.js-0f74fe7d0a2fb1c02c5beebf5f0f8360020f1fc1.zip |
Eliminate matrix translation errors
Diffstat (limited to 'src/matrix.js')
-rw-r--r-- | src/matrix.js | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/matrix.js b/src/matrix.js index b6c839d..314e1e0 100644 --- a/src/matrix.js +++ b/src/matrix.js @@ -4,7 +4,7 @@ SVG.Matrix = SVG.invent({ var i, base = arrayToMatrix([1, 0, 0, 1, 0, 0]) // Ensure source as object - source = source.node && source.node.getCTM ? + source = source && source.node && source.node.getCTM ? source.node.getCTM() : typeof source === 'string' ? arrayToMatrix(source.replace(/\s/g, '').split(',')) : @@ -25,8 +25,8 @@ SVG.Matrix = SVG.invent({ // Extract individual transformations extract: function() { // Find transform points - var px = deltaTransformPoint(this, { x: 0, y: 1 }) - , py = deltaTransformPoint(this, { x: 1, y: 0 }) + var px = deltaTransformPoint(this, 0, 1) + , py = deltaTransformPoint(this, 1, 0) , skewX = 180 / Math.PI * Math.atan2(px.y, px.x) - 90 return { |