fix(docs): Change examples to actually use the documented method
This commit is contained in:
parent
de00e16f76
commit
2225d1ea83
2 changed files with 17 additions and 24 deletions
|
@ -34,7 +34,7 @@ Path path.attr(
|
||||||
paths.example = new Path()
|
paths.example = new Path()
|
||||||
.move(points.from)
|
.move(points.from)
|
||||||
.curve(points.cp1, points.cp2, points.to)
|
.curve(points.cp1, points.cp2, points.to)
|
||||||
.setClass("canvas")
|
.attr("class", "canvas")
|
||||||
.setText("FreeSewing rocks", "text-xs center")
|
.setText("FreeSewing rocks", "text-xs center")
|
||||||
|
|
||||||
return part
|
return part
|
||||||
|
|
|
@ -14,7 +14,7 @@ float path.length()
|
||||||
|
|
||||||
<Example caption="Example of the Path.length() method">
|
<Example caption="Example of the Path.length() method">
|
||||||
```js
|
```js
|
||||||
({ Point, points, Path, paths, macro, part }) => {
|
({ Point, points, Path, paths, macro, utils, part }) => {
|
||||||
|
|
||||||
points.A = new Point(45, 60)
|
points.A = new Point(45, 60)
|
||||||
points.B = new Point(10, 30)
|
points.B = new Point(10, 30)
|
||||||
|
@ -22,28 +22,21 @@ float path.length()
|
||||||
points.C = new Point(90, 30)
|
points.C = new Point(90, 30)
|
||||||
points.CCp1 = new Point(50, -30)
|
points.CCp1 = new Point(50, -30)
|
||||||
|
|
||||||
paths.example = new Path()
|
paths.AB = new Path()
|
||||||
.move(points.A)
|
.move(points.A)
|
||||||
.line(points.B)
|
.line(points.B)
|
||||||
|
|
||||||
|
paths.BC = new Path()
|
||||||
|
.move(points.B)
|
||||||
.curve(points.BCp2, points.CCp1, points.C)
|
.curve(points.BCp2, points.CCp1, points.C)
|
||||||
|
|
||||||
macro("pd", {
|
const lengthAB = paths.AB.length()
|
||||||
path: paths.example,
|
const lengthBC = paths.BC.length()
|
||||||
d: -20
|
|
||||||
})
|
|
||||||
|
|
||||||
macro("pd", {
|
paths.AB.addText(utils.round(lengthAB) + " mm")
|
||||||
path: new Path().move(points.B).line(points.A),
|
paths.BC.addText(utils.round(lengthBC) + " mm")
|
||||||
d: 10
|
|
||||||
})
|
|
||||||
|
|
||||||
macro("pd", {
|
|
||||||
path: new Path().move(points.B).curve(points.BCp2, points.CCp1, points.C),
|
|
||||||
d: -10
|
|
||||||
})
|
|
||||||
|
|
||||||
return part
|
return part
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
</Example>
|
</Example>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue