1
0
mirror of https://github.com/svg/svgo.git synced 2025-07-29 20:21:14 +03:00

fix viewBox round

This commit is contained in:
caub
2017-06-14 12:03:14 +02:00
parent 19e2c9ac15
commit 8592d2080b
2 changed files with 5 additions and 4 deletions

View File

@ -41,8 +41,9 @@ exports.fn = function(item, params) {
if (item.hasAttr('viewBox')) {
var nums = item.attr('viewBox').value.split(/[ ,]/g);
item.attr('viewBox').value = nums.map(function(num) {
return +num.toFixed(floatPrecision);
item.attr('viewBox').value = nums.map(function(value) {
var num = +value;
return isNaN(num) ? value : +num.toFixed(floatPrecision);
}).join(' ');
}