svg-path-simplify 0.4.6 → 0.4.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -0
- package/README.md +16 -14
- package/dist/svg-path-simplify.esm.js +6 -0
- package/dist/svg-path-simplify.esm.min.js +1 -1
- package/dist/svg-path-simplify.js +6 -0
- package/dist/svg-path-simplify.min.js +1 -1
- package/dist/svg-path-simplify.pathdata.esm.js +5 -0
- package/dist/svg-path-simplify.pathdata.esm.min.js +1 -1
- package/package.json +1 -1
- package/src/pathSimplify-main.js +3 -1
- package/src/svgii/pathData_convert.js +7 -0
- package/v/0.4.5/index.html +0 -1040
- package/v/0.4.5/svg-path-simplify.js +0 -13227
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -103,6 +103,22 @@ Cleanup for:
|
|
|
103
103
|
|
|
104
104
|
## Usage
|
|
105
105
|
|
|
106
|
+
### Web app
|
|
107
|
+
You can easily test this library via the [**webapp**](https://herrstrietzel.github.io/svg-path-simplify/) or by checking the demo folder.
|
|
108
|
+
|
|
109
|
+
[](https://herrstrietzel.github.io/svg-path-simplify/)
|
|
110
|
+
|
|
111
|
+
#### Features
|
|
112
|
+
* test all provided simplification option - export settings as JS object
|
|
113
|
+
* preview different settings
|
|
114
|
+
* accepts SVG files
|
|
115
|
+
* path data strings
|
|
116
|
+
* supports multi file batch processing
|
|
117
|
+
* open results in codepen or svg-path-editor
|
|
118
|
+
* download self contained SVG
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
|
|
106
122
|
### Browser
|
|
107
123
|
|
|
108
124
|
#### Example 1: parse and simplify (using defaults)
|
|
@@ -299,20 +315,6 @@ let pathDataOpt = simplifyPathData(pathDataString);
|
|
|
299
315
|
|
|
300
316
|
|
|
301
317
|
## Demos
|
|
302
|
-
### Web app
|
|
303
|
-
You can easily test this library via the [**webapp**](https://herrstrietzel.github.io/svg-path-simplify/) or by checking the demo folder.
|
|
304
|
-
|
|
305
|
-

|
|
306
|
-
|
|
307
|
-
#### Features
|
|
308
|
-
* test all provided simplification option - export settings as JS object
|
|
309
|
-
* preview different settings
|
|
310
|
-
* accepts SVG files
|
|
311
|
-
* path data strings
|
|
312
|
-
* supports multi file batch processing
|
|
313
|
-
* open results in codepen or svg-path-editor
|
|
314
|
-
* download self contained SVG
|
|
315
|
-
|
|
316
318
|
|
|
317
319
|
### Demo files
|
|
318
320
|
* [simple setup IIFE](./demo/simple-iife.html)
|
|
@@ -4318,6 +4318,11 @@ function optimizeArcPathData(pathData = []) {
|
|
|
4318
4318
|
|
|
4319
4319
|
let [rx, ry, largeArc, x, y] = [values[0], values[1], values[3], values[5], values[6]];
|
|
4320
4320
|
let comPrev = pathData[i - 1];
|
|
4321
|
+
|
|
4322
|
+
// force absolute
|
|
4323
|
+
rx = Math.abs(rx);
|
|
4324
|
+
ry = Math.abs(ry);
|
|
4325
|
+
|
|
4321
4326
|
let [x0, y0] = [comPrev.values[comPrev.values.length - 2], comPrev.values[comPrev.values.length - 1]];
|
|
4322
4327
|
let M = { x: x0, y: y0 };
|
|
4323
4328
|
let p = { x, y };
|
|
@@ -13083,6 +13088,7 @@ function svgPathSimplify(input = '', settings = {}) {
|
|
|
13083
13088
|
// if polygon we already heave absolute coordinates
|
|
13084
13089
|
|
|
13085
13090
|
let pathData = parsePathDataNormalized(d, { quadraticToCubic, arcToCubic });
|
|
13091
|
+
console.log('!!!pathData', pathData, arcToCubic);
|
|
13086
13092
|
|
|
13087
13093
|
// get polygon bbox
|
|
13088
13094
|
let bb_poly = smoothPoly || toPolygon ? getPolyBBox(getPathDataVertices(pathData)) : null;
|