1
0
mirror of https://github.com/svg/svgo.git synced 2025-07-31 07:44:22 +03:00

After ‘arcto’ path command(a or A) flags, spaces are no longer removed by default (#1353)

Co-authored-by: 壹丝 <jie.lijie@alibaba-inc.com>
This commit is contained in:
一丝
2021-02-20 23:58:42 +08:00
committed by GitHub
parent 26f5e323dd
commit 8d7cfa02c7
14 changed files with 41 additions and 31 deletions

View File

@ -80,7 +80,8 @@ exports.cleanupOutData = function(data, params, command) {
// no extra space in front of first number
if (i == 0) delimiter = '';
// no extra space after 'arcto' command flags
// no extra space after 'arcto' command flags(large-arc and sweep flags)
// a20 60 45 0 1 30 20 → a20 60 45 0130 20
if (params.noSpaceAfterFlags && (command == 'A' || command == 'a')) {
var pos = i % 7;
if (pos == 4 || pos == 5) delimiter = '';

View File

@ -23,8 +23,8 @@ exports.params = {
utilizeAbsolute: true,
leadingZero: true,
negativeExtraSpace: true,
noSpaceAfterFlags: true,
forceAbsolutePath: false
noSpaceAfterFlags: false, // a20 60 45 0 1 30 20 → a20 60 45 0130 20
forceAbsolutePath: false,
};
var pathElems = require('./_collections.js').pathElems,

View File

@ -11,7 +11,7 @@ exports.params = {
force: false,
leadingZero: true,
negativeExtraSpace: true,
noSpaceAfterFlags: true
noSpaceAfterFlags: false, // a20 60 45 0 1 30 20 → a20 60 45 0130 20
};
var path2js = require('./_path.js').path2js,

View File

@ -0,0 +1,9 @@
<svg viewBox="0 0 1200 400" xmlns="http://www.w3.org/2000/svg">
<path d="M300 200 h-150 a150 150 0 1 0 150 -150 z" fill="red" stroke="blue" stroke-width="5" />
</svg>
@@@
<svg viewBox="0 0 1200 400" xmlns="http://www.w3.org/2000/svg">
<path d="M300 200H150A150 150 0 1 0 300 50z" fill="red" stroke="blue" stroke-width="5"/>
</svg>

After

Width:  |  Height:  |  Size: 341 B