Strange, I don’t know why Rafael decided to do this. But not too hard to get around:
If you refer to the source for the .transformPath () method, you will see that it is part of two other utility methods:
transformPath = R.transformPath = function (path, transform) { return mapPath(path, toMatrix(path, transform)); }
Pretty straightforward: .toMatrix () analyzes the conversion of a string into a matrix, and mapPath applies this matrix to a path string.
For some reason mapPath includes a method call . path2curve () , so you are having problems. Therefore, we need to grab the source for this method and change it:
var mapPathStraight = function (path, matrix) { if (!matrix) { return path; } var x, y, i, j, ii, jj, pathi;
Now we can reach a straight line:
var trpath = mapPathStraight(path, Raphael.toMatrix(path, trans));
Which gives me the conclusion:
trpath: M100,110L140,150
Here jsFiddle
source share