modern-path2d 1.0.1 → 1.1.0
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/README.md +6 -4
- package/dist/index.cjs +1516 -899
- package/dist/index.d.cts +253 -254
- package/dist/index.d.mts +253 -254
- package/dist/index.d.ts +253 -254
- package/dist/index.js +2 -2
- package/dist/index.mjs +1498 -889
- package/package.json +7 -3
package/README.md
CHANGED
|
@@ -26,7 +26,9 @@
|
|
|
26
26
|
|
|
27
27
|
- Path transform
|
|
28
28
|
|
|
29
|
-
-
|
|
29
|
+
- Path triangulate
|
|
30
|
+
|
|
31
|
+
- Parse svg to Path2DSet
|
|
30
32
|
|
|
31
33
|
- TypeScript
|
|
32
34
|
|
|
@@ -39,7 +41,7 @@ npm i modern-path2d
|
|
|
39
41
|
## 🦄 Usage
|
|
40
42
|
|
|
41
43
|
```ts
|
|
42
|
-
import { parseSVG, Path2D } from 'modern-path2d'
|
|
44
|
+
import { parseSVG, Path2D, Path2DSet } from 'modern-path2d'
|
|
43
45
|
|
|
44
46
|
const path = new Path2D()
|
|
45
47
|
|
|
@@ -79,8 +81,8 @@ console.log(path.toCommands())
|
|
|
79
81
|
path.drawTo(document.getElementById('canvas').getContext('2d'))
|
|
80
82
|
|
|
81
83
|
// export to canvas
|
|
82
|
-
document.body.append(path.toCanvas())
|
|
84
|
+
document.body.append(new Path2DSet([path]).toCanvas())
|
|
83
85
|
|
|
84
86
|
// export to svg
|
|
85
|
-
document.body.append(path.toSVG())
|
|
87
|
+
document.body.append(new Path2DSet([path]).toSVG())
|
|
86
88
|
```
|