After ‘arcto’ path command(a or A) flags, spaces are no longer removed by default (#1353)
Co-authored-by: 壹丝 <jie.lijie@alibaba-inc.com>
@ -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,
|
||||||
|
@ -15,5 +15,5 @@
|
|||||||
<path d="M10 50c10-20 30 0 50 20S20 30 30 60"/>
|
<path d="M10 50c10-20 30 0 50 20S20 30 30 60"/>
|
||||||
<path d="M10 50q20 10 20 20"/>
|
<path d="M10 50q20 10 20 20"/>
|
||||||
<path d="M10 50q20 10 20 20t10 0"/>
|
<path d="M10 50q20 10 20 20t10 0"/>
|
||||||
<path d="M10 50a20 60 45 0130 20"/>
|
<path d="M10 50a20 60 45 0 1 30 20"/>
|
||||||
</svg>
|
</svg>
|
||||||
|
Before Width: | Height: | Size: 601 B After Width: | Height: | Size: 603 B |
@ -32,8 +32,8 @@
|
|||||||
<path d="M10 50q20 10 20 20 10 0 20 20"/>
|
<path d="M10 50q20 10 20 20 10 0 20 20"/>
|
||||||
<path d="M10 50q20 10 20 20t10 0 10 20"/>
|
<path d="M10 50q20 10 20 20t10 0 10 20"/>
|
||||||
<path d="M10 50q20 10 20 20t10 0 10 20"/>
|
<path d="M10 50q20 10 20 20t10 0 10 20"/>
|
||||||
<path d="M10 50a20 60 45 0130 20 30 50-30 1110 0"/>
|
<path d="M10 50a20 60 45 0 1 30 20 30 50-30 1 1 10 0"/>
|
||||||
<path d="M10 50a20 60 45 0130 20 30 50-30 1110 0"/>
|
<path d="M10 50a20 60 45 0 1 30 20 30 50-30 1 1 10 0"/>
|
||||||
<path d="M0 0v5 5" marker-mid="url(#)"/>
|
<path d="M0 0v5 5" marker-mid="url(#)"/>
|
||||||
<path d="M0 0h0" stroke="black" stroke-linecap="round"/>
|
<path d="M0 0h0" stroke="black" stroke-linecap="round"/>
|
||||||
</svg>
|
</svg>
|
||||||
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
@ -16,6 +16,6 @@
|
|||||||
<path d="M10 50c20 30 40 50 60 70s20 40 40 50L10 20"/>
|
<path d="M10 50c20 30 40 50 60 70s20 40 40 50L10 20"/>
|
||||||
<path d="M10 50q20 60 30 70-20-60-10-50"/>
|
<path d="M10 50q20 60 30 70-20-60-10-50"/>
|
||||||
<path d="M10 50q20 60 30 70t40 70L10 20"/>
|
<path d="M10 50q20 60 30 70t40 70L10 20"/>
|
||||||
<path d="M10 50a20 60 45 0140 70 20 60 45 01-10-50"/>
|
<path d="M10 50a20 60 45 0 1 40 70 20 60 45 0 1-10-50"/>
|
||||||
<path d="M1 1v8-6"/>
|
<path d="M1 1v8-6"/>
|
||||||
</svg>
|
</svg>
|
||||||
|
Before Width: | Height: | Size: 811 B After Width: | Height: | Size: 814 B |
@ -40,7 +40,7 @@
|
|||||||
<path transform="" d="M0 0v100l70-50zm70 50l70-50v100z"/>
|
<path transform="" d="M0 0v100l70-50zm70 50l70-50v100z"/>
|
||||||
<path fill="red" d="M118.742 187.108l79.162 124.74-96.593-25.883 8.716-49.428c17.43-98.857 89.875-79.446 81.16-30.017s63.728 68.84 72.444 19.411q13.073-74.143 87.877 75.31t193.185 51.764z"/>
|
<path fill="red" d="M118.742 187.108l79.162 124.74-96.593-25.883 8.716-49.428c17.43-98.857 89.875-79.446 81.16-30.017s63.728 68.84 72.444 19.411q13.073-74.143 87.877 75.31t193.185 51.764z"/>
|
||||||
<path fill="red" stroke="red" transform="rotate(15) scale(.5) skewX(5) translate(200,100)" d="M100 200l200 200H100V300c0-200 150-200 150-100s150 100 150 0q0-150 200 100t400 0z"/>
|
<path fill="red" stroke="red" transform="rotate(15) scale(.5) skewX(5) translate(200,100)" d="M100 200l200 200H100V300c0-200 150-200 150-100s150 100 150 0q0-150 200 100t400 0z"/>
|
||||||
<path fill="red" stroke="red" transform="rotate(15) scale(.5) skewX(5) translate(200,100)" d="M100 200l200 200H100V300c0-200 150-200 150-100s150 100 150 0q0-150 200 100t400 0a150 150 0 10150-150z"/>
|
<path fill="red" stroke="red" transform="rotate(15) scale(.5) skewX(5) translate(200,100)" d="M100 200l200 200H100V300c0-200 150-200 150-100s150 100 150 0q0-150 200 100t400 0a150 150 0 1 0 150-150z"/>
|
||||||
<path fill="red" stroke="red" d="M106.066 183.712l70.71 122.474-96.592-25.882 12.941-48.296c25.882-96.593 98.326-77.181 85.385-28.885s59.504 67.708 72.445 19.412q19.411-72.445 83.652 74.178t193.185 51.764z" stroke-width=".5"/>
|
<path fill="red" stroke="red" d="M106.066 183.712l70.71 122.474-96.592-25.882 12.941-48.296c25.882-96.593 98.326-77.181 85.385-28.885s59.504 67.708 72.445 19.412q19.411-72.445 83.652 74.178t193.185 51.764z" stroke-width=".5"/>
|
||||||
<path fill="red" stroke="red" d="M318.198 551.135L530.33 918.56l-289.778-77.646 38.823-144.889c77.646-289.778 294.98-231.543 256.156-86.655s178.51 203.124 217.334 58.235q58.234-217.334 250.955 222.534t579.555 155.292z" stroke-width="1.5"/>
|
<path fill="red" stroke="red" d="M318.198 551.135L530.33 918.56l-289.778-77.646 38.823-144.889c77.646-289.778 294.98-231.543 256.156-86.655s178.51 203.124 217.334 58.235q58.234-217.334 250.955 222.534t579.555 155.292z" stroke-width="1.5"/>
|
||||||
<path fill="red" stroke="red" d="M70.004 121.25l46.669 80.833L52.922 185l8.54-31.876c17.083-63.75 64.896-50.94 56.355-19.064s39.272 44.687 47.813 12.812q12.812-47.814 55.21 48.957t127.503 34.165z" stroke-width=".33"/>
|
<path fill="red" stroke="red" d="M70.004 121.25l46.669 80.833L52.922 185l8.54-31.876c17.083-63.75 64.896-50.94 56.355-19.064s39.272 44.687 47.813 12.812q12.812-47.814 55.21 48.957t127.503 34.165z" stroke-width=".33"/>
|
||||||
@ -58,14 +58,14 @@
|
|||||||
</g>
|
</g>
|
||||||
<path fill="url(#gradient)" transform="rotate(15) scale(0.33) translate(200,100)" d="M100 200l200 200H100V300c0-200 150-200 150-100s150 100 150 0q0-150 200 100t400 0z"/>
|
<path fill="url(#gradient)" transform="rotate(15) scale(0.33) translate(200,100)" d="M100 200l200 200H100V300c0-200 150-200 150-100s150 100 150 0q0-150 200 100t400 0z"/>
|
||||||
<path clip-path="url(#a)" transform="rotate(15) scale(0.33) translate(200,100)" d="M100 200l200 200H100V300c0-200 150-200 150-100s150 100 150 0q0-150 200 100t400 0z"/>
|
<path clip-path="url(#a)" transform="rotate(15) scale(0.33) translate(200,100)" d="M100 200l200 200H100V300c0-200 150-200 150-100s150 100 150 0q0-150 200 100t400 0z"/>
|
||||||
<path d="M10 0a10 10 0 1020 0"/>
|
<path d="M10 0a10 10 0 1 0 20 0"/>
|
||||||
<path d="M3.864 1.035a8 12 15 1015.455 4.141"/>
|
<path d="M3.864 1.035a8 12 15 1 0 15.455 4.141"/>
|
||||||
<path d="M3.536 3.536a10 10 0 1014.142 14.142"/>
|
<path d="M3.536 3.536a10 10 0 1 0 14.142 14.142"/>
|
||||||
<path d="M5 0a16.18 6.18 31.717 1020 0"/>
|
<path d="M5 0a16.18 6.18 31.717 1 0 20 0"/>
|
||||||
<path d="M-12.122 332.074a80 240 15 10154.548 41.41 80 240 15 10-154.548-41.41"/>
|
<path d="M-12.122 332.074a80 240 15 1 0 154.548 41.41 80 240 15 1 0-154.548-41.41"/>
|
||||||
<path d="M721.72 450.759a240 80 15 1041.412-154.548 240 80 15 10-41.411 154.548"/>
|
<path d="M721.72 450.759a240 80 15 1 0 41.412-154.548 240 80 15 1 0-41.411 154.548"/>
|
||||||
<path d="M8.6 6.4L5.4 9.5l3.2 3.1-.7.8L4 9.5l3.9-3.9zM5 10V9h10v1z"/>
|
<path d="M8.6 6.4L5.4 9.5l3.2 3.1-.7.8L4 9.5l3.9-3.9zM5 10V9h10v1z"/>
|
||||||
<path d="M561.214 392.766a48.107 95.08 10.132 11-94.083-20.365 48.107 95.079 10.132 1194.082 20.365z"/>
|
<path d="M561.214 392.766a48.107 95.08 10.132 1 1-94.083-20.365 48.107 95.079 10.132 1 1 94.082 20.365z"/>
|
||||||
<path d="M-1.26-1.4a6.53 1.8-15.2 1112.55-3.44"/>
|
<path d="M-1.26-1.4a6.53 1.8-15.2 1 1 12.55-3.44"/>
|
||||||
<path d="M0 0l.21 3.99.21 3.99"/>
|
<path d="M0 0l.21 3.99.21 3.99"/>
|
||||||
</svg>
|
</svg>
|
||||||
|
Before Width: | Height: | Size: 6.7 KiB After Width: | Height: | Size: 6.7 KiB |
@ -13,13 +13,13 @@
|
|||||||
@@@
|
@@@
|
||||||
|
|
||||||
<svg xmlns="http://www.w3.org/2000/svg">
|
<svg xmlns="http://www.w3.org/2000/svg">
|
||||||
<path d="M0 0a5 5 0 015 5"/>
|
<path d="M0 0a5 5 0 0 1 5 5"/>
|
||||||
<path d="M0 0a5 5 0 015 5l5-5"/>
|
<path d="M0 0a5 5 0 0 1 5 5l5-5"/>
|
||||||
<path d="M15 10a5 5 0 115-5l-5 5"/>
|
<path d="M15 10a5 5 0 1 1 5-5l-5 5"/>
|
||||||
<path d="M41.008.102a5.006 5.006 0 013.849 3.705"/>
|
<path d="M41.008.102a5.006 5.006 0 0 1 3.849 3.705"/>
|
||||||
<path d="M7.234 19.474a5 5 0 01-4.933-8.683"/>
|
<path d="M7.234 19.474a5 5 0 0 1-4.933-8.683"/>
|
||||||
<path d="M60 0a5 5 0 10.001 10.001A5 5 0 0060 0z"/>
|
<path d="M60 0a5 5 0 1 0 .001 10.001A5 5 0 0 0 60 0z"/>
|
||||||
<path d="M15 23.54a8.493 8.493 0 01-5.25-1.807"/>
|
<path d="M15 23.54a8.493 8.493 0 0 1-5.25-1.807"/>
|
||||||
<path d="M-9.5 82.311a4.81 4.81 0 11.002-9.622A4.81 4.81 0 01-9.5 82.31z"/>
|
<path d="M-9.5 82.311a4.81 4.81 0 1 1 .002-9.622A4.81 4.81 0 0 1-9.5 82.31z"/>
|
||||||
<path d="M1.5 13.456a3.418 3.418 0 006.729.854z"/>
|
<path d="M1.5 13.456a3.418 3.418 0 0 0 6.729.854z"/>
|
||||||
</svg>
|
</svg>
|
||||||
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
@ -6,7 +6,7 @@
|
|||||||
@@@
|
@@@
|
||||||
|
|
||||||
<svg xmlns="http://www.w3.org/2000/svg">
|
<svg xmlns="http://www.w3.org/2000/svg">
|
||||||
<path d="M.49 8.8A6.44 6.44 0 016.48.02a6.44 6.44 0 015.99 8.78"/>
|
<path d="M.49 8.8A6.44 6.44 0 0 1 6.48.02a6.44 6.44 0 0 1 5.99 8.78"/>
|
||||||
<path d="M13.4 6.62c0-2.5-1.98-4.57-4.4-4.57S4.6 4.1 4.6 6.62"/>
|
<path d="M13.4 6.62c0-2.5-1.98-4.57-4.4-4.57S4.6 4.1 4.6 6.62"/>
|
||||||
</svg>
|
</svg>
|
||||||
|
|
||||||
|
Before Width: | Height: | Size: 468 B After Width: | Height: | Size: 472 B |
@ -6,7 +6,7 @@
|
|||||||
@@@
|
@@@
|
||||||
|
|
||||||
<svg xmlns="http://www.w3.org/2000/svg">
|
<svg xmlns="http://www.w3.org/2000/svg">
|
||||||
<path d="M0 9V6a6 6 0 1112 3"/>
|
<path d="M0 9V6a6 6 0 1 1 12 3"/>
|
||||||
<path d="M13 7c0-3-2-5-4-5S5 4 5 7"/>
|
<path d="M13 7c0-3-2-5-4-5S5 4 5 7"/>
|
||||||
</svg>
|
</svg>
|
||||||
|
|
||||||
|
Before Width: | Height: | Size: 406 B After Width: | Height: | Size: 408 B |
@ -5,5 +5,5 @@
|
|||||||
@@@
|
@@@
|
||||||
|
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 36 36">
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 36 36">
|
||||||
<path d="M32 32a4 4 0 01-4 4H8a4 4 0 00-4-4V4a4 4 0 004-4h20a4 4 0 014 4v28z" fill="#888"/>
|
<path d="M32 32a4 4 0 0 1-4 4H8a4 4 0 0 0-4-4V4a4 4 0 0 0 4-4h20a4 4 0 0 1 4 4v28z" fill="#888"/>
|
||||||
</svg>
|
</svg>
|
||||||
|
Before Width: | Height: | Size: 373 B After Width: | Height: | Size: 379 B |
@ -5,5 +5,5 @@
|
|||||||
@@@
|
@@@
|
||||||
|
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 36 36">
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 36 36">
|
||||||
<path d="M32 4a4 4 0 00-4-4H8a4 4 0 01-4 4v28a4 4 0 014 4h20a4 4 0 004-4V4z"/>
|
<path d="M32 4a4 4 0 0 0-4-4H8a4 4 0 0 1-4 4v28a4 4 0 0 1 4 4h20a4 4 0 0 0 4-4V4z"/>
|
||||||
</svg>
|
</svg>
|
||||||
|
Before Width: | Height: | Size: 308 B After Width: | Height: | Size: 314 B |
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 |
@ -29,7 +29,7 @@
|
|||||||
<path d="M0 10H60L30 50z"/>
|
<path d="M0 10H60L30 50z"/>
|
||||||
<path d="M0 0V50L50 0M0 60L50 10V60"/>
|
<path d="M0 0V50L50 0M0 60L50 10V60"/>
|
||||||
<g>
|
<g>
|
||||||
<path d="M100 0a50 50 0 010 100M25 25H75V75H25z"/>
|
<path d="M100 0a50 50 0 0 1 0 100M25 25H75V75H25z"/>
|
||||||
<path d="M135 85H185V135H135z"/>
|
<path d="M135 85H185V135H135z"/>
|
||||||
</g>
|
</g>
|
||||||
<g>
|
<g>
|
||||||
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |