diff --git a/markdown/dev/reference/api/part/draft/en.md b/markdown/dev/reference/api/part/draft/en.md index 2e6a7c05c07..bef7ea6a70e 100644 --- a/markdown/dev/reference/api/part/draft/en.md +++ b/markdown/dev/reference/api/part/draft/en.md @@ -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 | diff --git a/markdown/dev/reference/api/utils/curveedge/en.md b/markdown/dev/reference/api/utils/curveedge/en.md index 8685916e2b6..7d30cb65ad2 100644 --- a/markdown/dev/reference/api/utils/curveedge/en.md +++ b/markdown/dev/reference/api/utils/curveedge/en.md @@ -17,7 +17,7 @@ Point utils.curveEdge( ```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) diff --git a/packages/core/src/part.mjs b/packages/core/src/part.mjs index c18882a799f..5943bb4d925 100644 --- a/packages/core/src/part.mjs +++ b/packages/core/src/part.mjs @@ -1,3 +1,4 @@ +import { Bezier } from 'bezier-js' import { Attributes } from './attributes.mjs' import * as utils from './utils.mjs' import { Point, pointsProxy } from './point.mjs' @@ -122,6 +123,7 @@ Part.prototype.shorthand = function () { store: this.context.store, units: this.__unitsClosure(), utils: utils, + Bezier: Bezier, } // Add top-level store methods and add a part name parameter const partName = this.name