diff options
| author | eleanor-park <eleanor_park@brown.edu> | 2024-09-22 15:40:19 -0400 |
|---|---|---|
| committer | eleanor-park <eleanor_park@brown.edu> | 2024-09-22 15:40:19 -0400 |
| commit | 692076b1356309111c4f2cb69cbdbf4be1a825bd (patch) | |
| tree | 5f93b482c0263907b3e53573a6ec89f88bbd01ce /src/client/util/bezierFit.ts | |
| parent | 7f4d53ce9f8cf3932b627ab063855e3323cc3dc2 (diff) | |
small bug fixes for smart draw
Diffstat (limited to 'src/client/util/bezierFit.ts')
| -rw-r--r-- | src/client/util/bezierFit.ts | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/client/util/bezierFit.ts b/src/client/util/bezierFit.ts index 4c7f4a0ba..4aef28e6b 100644 --- a/src/client/util/bezierFit.ts +++ b/src/client/util/bezierFit.ts @@ -696,7 +696,7 @@ export function SVGToBezier(name: SVGType, attributes: any): Point[] { const matches: RegExpMatchArray[] = Array.from( attributes.d.matchAll(/Q(-?\d+\.?\d*),(-?\d+\.?\d*) (-?\d+\.?\d*),(-?\d+\.?\d*)|C(-?\d+\.?\d*),(-?\d+\.?\d*) (-?\d+\.?\d*),(-?\d+\.?\d*) (-?\d+\.?\d*),(-?\d+\.?\d*)|L(-?\d+\.?\d*),(-?\d+\.?\d*)/g) ); - let lastPt: Point = { X: 0, Y: 0 }; + let lastPt: Point = startPt; matches.forEach(match => { if (match[0].startsWith('Q')) { coordList.push({ X: parseInt(match[1]), Y: parseInt(match[2]) }); @@ -711,7 +711,7 @@ export function SVGToBezier(name: SVGType, attributes: any): Point[] { coordList.push({ X: parseInt(match[9]), Y: parseInt(match[10]) }); lastPt = { X: parseInt(match[9]), Y: parseInt(match[10]) }; } else { - coordList.push(lastPt || { X: parseInt(startPt[1]), Y: parseInt(startPt[2]) }); + coordList.push(lastPt); coordList.push({ X: parseInt(match[11]), Y: parseInt(match[12]) }); coordList.push({ X: parseInt(match[11]), Y: parseInt(match[12]) }); coordList.push({ X: parseInt(match[11]), Y: parseInt(match[12]) }); |
