1
0
Fork 0

feat: Export Bezier in shorthand call + docs

This commit is contained in:
Joost De Cock 2022-12-12 18:45:51 +01:00
parent e3aa8b1d7e
commit c5d4eae079
3 changed files with 5 additions and 5 deletions

View file

@ -41,6 +41,7 @@ access the following properties:
| `unhide` | See [the unhide documentation](/reference/api/part/unhide) |
| `units` | A version of [`utils.units()`](/reference/api/utils/units) that is preconfigured with the user's chosenunits |
| `utils` | See [the utils documentation](/reference/api/utils) |
| `Bezier` | The [bezier-js](https://pomax.github.io/bezierjs/) library's `Bezier` named export |
|| **_Return value_** |
| `part` | Your draft method **must** return this |

View file

@ -17,7 +17,7 @@ Point utils.curveEdge(
<Example caption="A Utils.curveEdge() example">
```js
({ Point, points, Path, paths, Snippet, snippets, utils, part }) => {
({ Point, points, Path, paths, Snippet, snippets, utils, Bezier, part }) => {
points.A = new Point(20, 10)
points.Acp = new Point(310, 40)
@ -28,15 +28,12 @@ Point utils.curveEdge(
.move(points.A)
.curve(points.Acp, points.Bcp, points.B)
/*
let curveA = new Bezier(
const curveA = new Bezier(
{ x: points.A.x, y: points.A.y },
{ x: points.Acp.x, y: points.Acp.y },
{ x: points.Bcp.x, y: points.Bcp.y },
{ x: points.B.x, y: points.B.y }
)
*/
let curveA = utils.bezier(points.A, points.Acp, points.Bcp, points.B)
points.edge = utils.curveEdge(curveA, "left")
snippets.edge = new Snippet("notch", points.edge)