mirror of
https://github.com/svg/svgo.git
synced 2025-07-29 20:21:14 +03:00
plugins/mergePaths: add space delimiter between z and m
This commit is contained in:
@ -16,7 +16,8 @@ exports.fn = function(item) {
|
|||||||
|
|
||||||
if (item.isElem() && !item.isEmpty()) {
|
if (item.isElem() && !item.isEmpty()) {
|
||||||
|
|
||||||
var prevContentItem;
|
var prevContentItem,
|
||||||
|
delim = '';
|
||||||
|
|
||||||
item.content = item.content.filter(function(contentItem) {
|
item.content = item.content.filter(function(contentItem) {
|
||||||
|
|
||||||
@ -30,7 +31,13 @@ exports.fn = function(item) {
|
|||||||
contentItem.hasAttr('d') &&
|
contentItem.hasAttr('d') &&
|
||||||
Object.keys(contentItem.attrs).length === 1
|
Object.keys(contentItem.attrs).length === 1
|
||||||
) {
|
) {
|
||||||
prevContentItem.attr('d').value += contentItem.attr('d').value;
|
// "zM", but "z m"
|
||||||
|
// looks like a FontForge parsing bug
|
||||||
|
if (contentItem.attr('d').value.charAt(0) === 'm') {
|
||||||
|
delim = ' ';
|
||||||
|
}
|
||||||
|
|
||||||
|
prevContentItem.attr('d').value += delim + contentItem.attr('d').value;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
<path d="M 30,30 z"/>
|
<path d="M 30,30 z"/>
|
||||||
<path d="M 30,30 z" fill="#f00"/>
|
<path d="M 30,30 z" fill="#f00"/>
|
||||||
<path d="M 40,40 z"/>
|
<path d="M 40,40 z"/>
|
||||||
|
<path d="m 50,50 z"/>
|
||||||
</svg>
|
</svg>
|
||||||
|
|
||||||
@@@
|
@@@
|
||||||
@ -13,5 +14,5 @@
|
|||||||
<path d="M 0,0 zM 10,10 zM 20,20"/>
|
<path d="M 0,0 zM 10,10 zM 20,20"/>
|
||||||
<path d="M 30,30 z"/>
|
<path d="M 30,30 z"/>
|
||||||
<path d="M 30,30 z" fill="#f00"/>
|
<path d="M 30,30 z" fill="#f00"/>
|
||||||
<path d="M 40,40 z"/>
|
<path d="M 40,40 z m 50,50 z"/>
|
||||||
</svg>
|
</svg>
|
||||||
|
Before Width: | Height: | Size: 396 B After Width: | Height: | Size: 432 B |
Reference in New Issue
Block a user