mirror of
https://github.com/svg/svgo.git
synced 2025-08-01 18:46:52 +03:00
fix viewBox round
This commit is contained in:
@ -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(' ');
|
||||
}
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="50.12356%" height="20px" x=".2655" y="-.2346">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="20.000001 -19.99999 17.123456 70.708090" width="50.12356%" height="20px" x=".2655" y="-.2346">
|
||||
<rect width="1in" heigth="12pt"/>
|
||||
</svg>
|
||||
|
||||
@@@
|
||||
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="50.124%" height="20" x=".266" y="-.235">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="20 -20 17.123 70.708" width="50.124%" height="20" x=".266" y="-.235">
|
||||
<rect width="96" heigth="16"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 275 B After Width: | Height: | Size: 356 B |
Reference in New Issue
Block a user