Skip to content

Commit

Permalink
fix: fixed optimization issues
Browse files Browse the repository at this point in the history
  • Loading branch information
jguddas committed Sep 23, 2023
1 parent 5fedd41 commit 98015cb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions site/src/pages/api/edit/optimize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ const removeTinySegments = (svg: string) => {
.toAbs()
.transform(SVGPathDataTransformer.NORMALIZE_HVZ());
const command = commander(data.children[i].attributes.d);
for (let j = 1; j < command.segments.length; j++) {
for (let j = 2; j < command.segments.length; j++) {
if (
isDistanceSmaller(pathData.commands[j] as Point, pathData.commands[j - 1] as Point, 0.05)
) {
Expand Down Expand Up @@ -483,7 +483,7 @@ const getCircle = (segments: PathSegment[]): INode | undefined => {
return undefined;
}
}
if (!isDistanceSmaller(prevPoint, startPoint, 0.1)) {
if (!prevCenters.length || !isDistanceSmaller(prevPoint, startPoint, 0.1)) {
return undefined;
}
return {
Expand Down Expand Up @@ -926,8 +926,8 @@ const runOptimizations = flow(
optimizeEllipse,
smartClose,
snapToGrid,
svgo,
fixDots,
svgo,
format
);

Expand Down

0 comments on commit 98015cb

Please sign in to comment.