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

Reset current cursor on Z

Ref https://github.com/svg/svgo/issues/1510
This commit is contained in:
Bogdan Chadkin
2021-08-13 18:34:12 +03:00
parent 179ca5c60f
commit 9e578b515a
2 changed files with 32 additions and 0 deletions

View File

@ -323,6 +323,11 @@ const applyMatrixToPathData = (pathData, matrix) => {
args[6] = y; args[6] = y;
} }
if (command === 'z' || command === 'Z') {
cursor[0] = start[0];
cursor[1] = start[1];
}
pathItem.instruction = command; pathItem.instruction = command;
pathItem.data = args; pathItem.data = args;
} }

View File

@ -0,0 +1,27 @@
Current cursor is reset by closepath command with the first moveto coords of segment
===
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 800 400" fill="#E7DACB">
<path
d="
M 152 65
V 158
H 49
V 65
z
m -14 75
V 83
H 67
V 141
z
"
transform="translate(-24, -41)"
/>
</svg>
@@@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 800 400" fill="#E7DACB">
<path d="M128 24v93H25V24zm-14 75V42H43v58z"/>
</svg>