From e54f50dbc21d434a8afe79641247ea45831f0706 Mon Sep 17 00:00:00 2001 From: Ivan Tsenilov Date: Sun, 25 Sep 2022 11:52:47 +0300 Subject: [PATCH] fix: SvgPath.parse fails on negative values --- src/svg/SvgPath.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/svg/SvgPath.ts b/src/svg/SvgPath.ts index 04a300f1..6eac827c 100644 --- a/src/svg/SvgPath.ts +++ b/src/svg/SvgPath.ts @@ -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((result, pathElement) => {