mirror of
https://github.com/svg/svgo.git
synced 2025-07-31 07:44:22 +03:00
fix viewBox round
This commit is contained in:
@ -41,8 +41,9 @@ exports.fn = function(item, params) {
|
|||||||
|
|
||||||
if (item.hasAttr('viewBox')) {
|
if (item.hasAttr('viewBox')) {
|
||||||
var nums = item.attr('viewBox').value.split(/[ ,]/g);
|
var nums = item.attr('viewBox').value.split(/[ ,]/g);
|
||||||
item.attr('viewBox').value = nums.map(function(num) {
|
item.attr('viewBox').value = nums.map(function(value) {
|
||||||
return +num.toFixed(floatPrecision);
|
var num = +value;
|
||||||
|
return isNaN(num) ? value : +num.toFixed(floatPrecision);
|
||||||
}).join(' ');
|
}).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"/>
|
<rect width="1in" heigth="12pt"/>
|
||||||
</svg>
|
</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"/>
|
<rect width="96" heigth="16"/>
|
||||||
</svg>
|
</svg>
|
||||||
|
Before Width: | Height: | Size: 275 B After Width: | Height: | Size: 356 B |
Reference in New Issue
Block a user