diff options
author | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2015-11-30 22:20:07 +0100 |
---|---|---|
committer | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2015-11-30 22:20:07 +0100 |
commit | dd2ad7824d546242468992436d9a631a60294e28 (patch) | |
tree | bd498a2b8949673db17ffaef880e220ceb346dcf /src/patharray.js | |
parent | 57ca267205f6c371d3328cc64355f111dbaf72a2 (diff) | |
download | svg.js-dd2ad7824d546242468992436d9a631a60294e28.tar.gz svg.js-dd2ad7824d546242468992436d9a631a60294e28.zip |
fixed bug related to the new path parser, text-method of tspan is a getter now, too
Diffstat (limited to 'src/patharray.js')
-rw-r--r-- | src/patharray.js | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/src/patharray.js b/src/patharray.js index 6bf7276..03a9b7f 100644 --- a/src/patharray.js +++ b/src/patharray.js @@ -122,23 +122,22 @@ SVG.extend(SVG.PathArray, { .trim() // trim .split(SVG.regex.whitespaces) // split into array + // at this place there could be parts like ['3.124.854.32'] because we could not determine the point as seperator till now + // we fix this elements in the next loop + for(i = array.length; --i;){ + if(array[i].indexOf('.') != array[i].lastIndexOf('.')){ + var split = array[i].split('.') // split at the point + var first = [split.shift(), split.shift()].join('.') // join the first number together + array.splice.apply(array, [i, 1].concat(first, split.map(function(el){ return '.'+el }))) // add first and all other entries back to array + } + } + }else{ array = array.reduce(function(prev, curr){ return [].concat.apply(prev, curr) }, []) } - // at this place there could be parts like ['3.124.854.32'] because we could not determine the point as seperator till now - // we fix this elements in the next loop - for(i = 0; i < array.length; ++i){ - if(array[i].indexOf('.') != array[i].lastIndexOf('.')){ - var split = array[i].split('.') // split at the point - var first = [split.shift(), split.shift()].join('.') // join the first number together - array.splice.apply(array, [i, 1].concat(first, split.map(function(el){ return '.'+el }))) // add first and all other entries back to array - i += split.length // dont forget to update the index - } - } - // array now is an array containing all parts of a path e.g. ['M', '0', '0', 'L', '30', '30' ...] var arr = [] @@ -150,8 +149,10 @@ SVG.extend(SVG.PathArray, { s = array[0] array.shift() // If last letter was a move command and we got no new, it defaults to [L]ine - }else if(s.toUpperCase() == 'M'){ + }else if(s == 'M'){ s = 'L' + }else if(s == 'm'){ + s = 'l' } // add path letter as first element |