Skip to content

Commit

Permalink
fix: SvgPath.parse fails on negative values
Browse files Browse the repository at this point in the history
  • Loading branch information
Arantiryo committed Sep 25, 2022
1 parent 5f716c3 commit e54f50d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/svg/SvgPath.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ export class SvgPath {
parse(path: string) {
// Parsing the SVG path string into an array of arrays [['M', '10', '10'], ['L', '100', '100']]
const chunks = path
.replace(/([A-Za-z])([0-9])/g, '$1 $2')
.replace(/([A-Za-z])(-?[0-9])/g, '$1 $2')
.replace(/([0-9])([A-Za-z])/g, '$1 $2')
.split(/[\s,]+/)
.reduce<string[][]>((result, pathElement) => {
Expand Down

0 comments on commit e54f50d

Please sign in to comment.