add Point.dist docs and unignore its folder
This commit is contained in:
parent
57048ecf1b
commit
fbd4b4d5f2
2 changed files with 36 additions and 0 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -91,3 +91,6 @@ scripts/verdaccio.sh
|
|||
|
||||
# Local Netlify folder
|
||||
.netlify
|
||||
|
||||
# Don't ignore the specific Points.dist() docs folder
|
||||
!markdown/dev/reference/api/point/dist
|
||||
|
|
33
markdown/dev/reference/api/point/dist/en.md
vendored
Normal file
33
markdown/dev/reference/api/point/dist/en.md
vendored
Normal file
|
@ -0,0 +1,33 @@
|
|||
---
|
||||
title: Point.dist()
|
||||
---
|
||||
|
||||
A point's `dist()` method returns the distance (in mm) between this point and the point you pass it.
|
||||
|
||||
```js
|
||||
float point.dist(Point point)
|
||||
```
|
||||
|
||||
<Example
|
||||
part="point_dist"
|
||||
caption="An example of the Point.dist() method"
|
||||
/>
|
||||
|
||||
```js
|
||||
let { Point, points, Path, paths } = part.shorthand()
|
||||
|
||||
points.from = new Point(10, 10)
|
||||
points.to = new Point(80, 70)
|
||||
|
||||
points.text = points.from
|
||||
.shiftFractionTowards(points.to, 0.6)
|
||||
.attr('data-text', points.from.dist(points.to) + 'mm')
|
||||
.attr('data-text-class', 'text-sm fill-note center')
|
||||
|
||||
paths.line = new Path()
|
||||
.move(points.from)
|
||||
.line(points.to)
|
||||
.attr('class', 'dashed')
|
||||
|
||||
return part
|
||||
```
|
Loading…
Add table
Add a link
Reference in a new issue