which doesn't use commas (',') to delimit matrix elements. see also:
http://www.w3.org/TR/SVG11/coords.html#SVGGlobalTransformAttribute
source = source
.replace(SVG.regex.whitespace, '')
.replace(SVG.regex.matrix, '')
- .split(',')
+ .split(SVG.regex.matrixElements)
// convert string values to floats and convert to a matrix-formatted object
return arrayToMatrix(
// Parse matrix wrapper
, matrix: /matrix\(|\)/g
+
+ // Elements of a matrix
+, matrixElements: /,*\s+|,/
// Whitespace
, whitespace: /\s/g
.split(/\)\s*/).slice(0,-1).map(function(str){
// generate key => value pairs
var kv = str.trim().split('(')
- return [kv[0], kv[1].split(',').map(function(str){ return parseFloat(str) })]
+ return [kv[0], kv[1].split(SVG.regex.matrixElements).map(function(str){ return parseFloat(str) })]
})
// calculate every transformation into one matrix
.reduce(function(matrix, transform){