Skip to content

Commit

Permalink
Merge pull request #2645 from rodovich/rotate-anchor
Browse files Browse the repository at this point in the history
Fix importing paths with `rotate` transforms with anchor coordinates.
  • Loading branch information
kangax committed Dec 3, 2015
2 parents c415792 + 17c4962 commit 35668b5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,16 @@
*/
fabric.parseTransformAttribute = (function() {
function rotateMatrix(matrix, args) {
var angle = args[0];
var angle = args[0],
x = (args.length === 3) ? args[1] : 0,
y = (args.length === 3) ? args[2] : 0;

matrix[0] = Math.cos(angle);
matrix[1] = Math.sin(angle);
matrix[2] = -Math.sin(angle);
matrix[3] = Math.cos(angle);
matrix[4] = x - (matrix[0] * x + matrix[2] * y);
matrix[5] = y - (matrix[1] * x + matrix[3] * y);
}

function scaleMatrix(matrix, args) {
Expand Down

0 comments on commit 35668b5

Please sign in to comment.