change example for dx()
change example for `dx()` dev docs to actually use `dx()`
This commit is contained in:
parent
44938fedec
commit
0c43b5d2c7
1 changed files with 25 additions and 8 deletions
|
@ -1,14 +1,31 @@
|
|||
export default (part) => {
|
||||
let { Point, points, macro } = part.shorthand()
|
||||
let { Point, points, Path, paths} = part.shorthand()
|
||||
|
||||
points.from = new Point(10, 10)
|
||||
points.to = new Point(90, 40)
|
||||
points.to = new Point(80, 70)
|
||||
|
||||
macro('hd', {
|
||||
from: points.from,
|
||||
to: points.to,
|
||||
y: 25,
|
||||
})
|
||||
paths.line = new Path()
|
||||
.move(points.from)
|
||||
.line(points.to)
|
||||
.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
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue