Skip to content

Commit f2dfb96

Browse files
committed
GreLI: handle both relative and absolute move
1 parent 2b92813 commit f2dfb96

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

plugins/convertPathData.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -852,7 +852,10 @@ function filters(path, params, { isSafeToUseZ, isSafeToRemove, hasMarkerMid }) {
852852
}
853853

854854
// remove useless non-first path segments
855-
if (params.removeUseless && isSafeToRemove(prev.command == 'M', true)) {
855+
if (
856+
params.removeUseless &&
857+
isSafeToRemove(prev.command == 'm' || prev.command == 'M', true)
858+
) {
856859
// l 0,0 / h 0 / v 0 / q 0,0 0,0 / t 0,0 / c 0,0 0,0 0,0 / s 0,0 0,0
857860
if (
858861
(command === 'l' ||
@@ -908,7 +911,10 @@ function filters(path, params, { isSafeToUseZ, isSafeToRemove, hasMarkerMid }) {
908911
if (
909912
(command === 'Z' || command === 'z') &&
910913
params.removeUseless &&
911-
isSafeToRemove(prev.command == 'M', isSafeToUseZ) &&
914+
isSafeToRemove(
915+
prev.command == 'm' || prev.command == 'M',
916+
isSafeToUseZ,
917+
) &&
912918
// @ts-expect-error
913919
Math.abs(item.base[0] - item.coords[0]) < error / 10 &&
914920
// @ts-expect-error

0 commit comments

Comments
 (0)