1
0
Fork 0

change example for dx()

change example for `dx()` dev docs to actually use `dx()`
This commit is contained in:
starfetch 2021-06-15 19:59:09 +02:00 committed by GitHub
parent 44938fedec
commit 0c43b5d2c7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,14 +1,31 @@
export default (part) => { export default (part) => {
let { Point, points, macro } = part.shorthand() let { Point, points, Path, paths} = part.shorthand()
points.from = new Point(10, 10) points.from = new Point(10, 10)
points.to = new Point(90, 40) points.to = new Point(80, 70)
macro('hd', { paths.line = new Path()
from: points.from, .move(points.from)
to: points.to, .line(points.to)
y: 25, .attr("class", "dashed");
})
return part points.totop = points.from.shift(0,points.from.dx(points.to))
points.text_dx = points.from
.shiftFractionTowards(points.totop, 0.6)
.shiftFractionTowards(points.to,0.1)
.attr("data-text", points.from.dx(points.to)+"mm")
.attr("data-text-class", "text-sm fill-note center");
paths.line_dx = new Path()
.move(points.from)
.line(points.totop)
.attr("class", "dashed");
paths.line_dy = new Path()
.move(points.to)
.line(points.totop)
.attr("class", "dashed");
return part
} }