From 38380602db73b7722a7b98fe830d89b3c81d23ae Mon Sep 17 00:00:00 2001 From: Alex Lockwood Date: Wed, 10 Jan 2018 12:52:13 -0800 Subject: [PATCH] fixes #24 --- package-lock.json | 16 ++++++++-------- package.json | 4 ++-- src/plugins/convertPathData.ts | 9 +++++---- test/plugins/convertPathData.14.xml | 2 +- test/plugins/convertPathData.15.xml | 2 +- test/plugins/convertPathData.16.xml | 2 +- test/plugins/convertPathData.22.xml | 19 +++++++++++++++++++ 7 files changed, 37 insertions(+), 17 deletions(-) create mode 100644 test/plugins/convertPathData.22.xml diff --git a/package-lock.json b/package-lock.json index 277bf9d..51fe0a7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,13 +16,13 @@ "integrity": "sha512-tE1SYtNG3I3atRVPELSGN2FJJJtPg3O/G0tycYSyzeDqdAbdLPRH089LhpWYA5M/iHeWHkVZq/b0OVKngcK0Eg==", "dev": true, "requires": { - "@types/node": "8.5.2" + "@types/node": "9.3.0" } }, "@types/node": { - "version": "8.5.2", - "resolved": "https://registry.npmjs.org/@types/node/-/node-8.5.2.tgz", - "integrity": "sha512-KA4GKOpgXnrqEH2eCVhiv2CsxgXGQJgV1X0vsGlh+WCnxbeAE1GT44ZsTU1IN5dEeV/gDupKa7gWo08V5IxWVQ==", + "version": "9.3.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-9.3.0.tgz", + "integrity": "sha512-wNBfvNjzsJl4tswIZKXCFQY0lss9nKUyJnG6T94X/eqjRgI2jHZ4evdjhQYBSan/vGtF6XVXPApOmNH2rf0KKw==", "dev": true }, "@types/sax": { @@ -31,7 +31,7 @@ "integrity": "sha1-MNXmvb8Sba9uQSxjklHdl0vUfNw=", "dev": true, "requires": { - "@types/node": "8.5.2" + "@types/node": "9.3.0" } }, "@types/strip-bom": { @@ -2377,9 +2377,9 @@ "dev": true }, "prettier": { - "version": "1.9.2", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-1.9.2.tgz", - "integrity": "sha512-piXx9N2WT8hWb7PBbX1glAuJVIkEyUV9F5fMXFINpZ0x3otVOFKKeGmeuiclFJlP/UrgTckyV606VjH2rNK4bw==", + "version": "1.10.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-1.10.1.tgz", + "integrity": "sha512-lPTx4BsvN5v9w/JXBRNlvTXCJBKrr7VW4NOl1rdX00x+YuOLqNYAOGk2x7v+4PI4hx/SyW1Z3AEg9MeB87yYcQ==", "dev": true }, "punycode": { diff --git a/package.json b/package.json index 7a9fa05..b80ab2a 100644 --- a/package.json +++ b/package.json @@ -32,13 +32,13 @@ "devDependencies": { "@types/chai": "^4.0.10", "@types/mocha": "^2.2.45", - "@types/node": "^8.5.2", + "@types/node": "^9.3.0", "@types/sax": "^1.0.0", "chai": "^4.1.2", "coveralls": "^3.0.0", "mocha": "^4.0.1", "nyc": "^11.4.1", - "prettier": "1.9.2", + "prettier": "1.10.1", "should": "^13.1.3", "ts-node": "^4.1.0", "typescript": "^2.6.2" diff --git a/src/plugins/convertPathData.ts b/src/plugins/convertPathData.ts index fd4535e..742f613 100644 --- a/src/plugins/convertPathData.ts +++ b/src/plugins/convertPathData.ts @@ -22,10 +22,11 @@ let arcTolerance: number; export const defaultParams = { applyTransforms: true, applyTransformsStroked: true, - makeArcs: { - threshold: 2.5, // Coefficient of rounding error. - tolerance: 0.5, // Percentage of radius. - }, + makeArcs: undefined as { threshold: number; tolerance: number }, + // { + // threshold: 2.5, // Coefficient of rounding error. + // tolerance: 0.5, // Percentage of radius. + // }, straightCurves: true, lineShorthands: true, curveSmoothShorthands: true, diff --git a/test/plugins/convertPathData.14.xml b/test/plugins/convertPathData.14.xml index 031a33d..36598ab 100644 --- a/test/plugins/convertPathData.14.xml +++ b/test/plugins/convertPathData.14.xml @@ -24,4 +24,4 @@ @@@ -{ "leadingZero": true } +{ "leadingZero": true, "makeArcs": { "threshold": 2.5, "tolerance": 0.5 } } diff --git a/test/plugins/convertPathData.15.xml b/test/plugins/convertPathData.15.xml index 3f9877f..a2fd34d 100644 --- a/test/plugins/convertPathData.15.xml +++ b/test/plugins/convertPathData.15.xml @@ -12,4 +12,4 @@ @@@ -{ "floatPrecision": 2, "leadingZero": true } +{ "floatPrecision": 2, "leadingZero": true, "makeArcs": { "threshold": 2.5, "tolerance": 0.5 } } diff --git a/test/plugins/convertPathData.16.xml b/test/plugins/convertPathData.16.xml index 5eaddcd..c75c2d8 100644 --- a/test/plugins/convertPathData.16.xml +++ b/test/plugins/convertPathData.16.xml @@ -12,4 +12,4 @@ @@@ -{ "floatPrecision": 0 } +{ "floatPrecision": 0, "makeArcs": { "threshold": 2.5, "tolerance": 0.5 } } diff --git a/test/plugins/convertPathData.22.xml b/test/plugins/convertPathData.22.xml new file mode 100644 index 0000000..195a66e --- /dev/null +++ b/test/plugins/convertPathData.22.xml @@ -0,0 +1,19 @@ + + + + +@@@ + + + +