mirror of
https://github.com/svg/svgo.git
synced 2025-08-09 02:22:08 +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:
@@ -80,7 +80,8 @@ exports.cleanupOutData = function(data, params, command) {
|
|||||||
// no extra space in front of first number
|
// no extra space in front of first number
|
||||||
if (i == 0) delimiter = '';
|
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')) {
|
if (params.noSpaceAfterFlags && (command == 'A' || command == 'a')) {
|
||||||
var pos = i % 7;
|
var pos = i % 7;
|
||||||
if (pos == 4 || pos == 5) delimiter = '';
|
if (pos == 4 || pos == 5) delimiter = '';
|
||||||
|
@@ -23,8 +23,8 @@ exports.params = {
|
|||||||
utilizeAbsolute: true,
|
utilizeAbsolute: true,
|
||||||
leadingZero: true,
|
leadingZero: true,
|
||||||
negativeExtraSpace: true,
|
negativeExtraSpace: true,
|
||||||
noSpaceAfterFlags: true,
|
noSpaceAfterFlags: false, // a20 60 45 0 1 30 20 → a20 60 45 0130 20
|
||||||
forceAbsolutePath: false
|
forceAbsolutePath: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
var pathElems = require('./_collections.js').pathElems,
|
var pathElems = require('./_collections.js').pathElems,
|
||||||
|
@@ -11,7 +11,7 @@ exports.params = {
|
|||||||
force: false,
|
force: false,
|
||||||
leadingZero: true,
|
leadingZero: true,
|
||||||
negativeExtraSpace: 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,
|
var path2js = require('./_path.js').path2js,
|
||||||
|
9
test/plugins/convertPathData.21.svg
Normal file
9
test/plugins/convertPathData.21.svg
Normal 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 |
Reference in New Issue
Block a user