register-mark
register-mark()
Register a custom mark to the canvas
The mark should contain both anchors called tip and base that are used to determine the marks orientation. If unset both default to (0, 0). An anchor named center is used as center of the mark, if present. Otherwise the mid between tip and base is used.
register-mark(":)", style => {
circle((0,0), radius: .5, fill: yellow)
arc((0,0), start: 180deg + 30deg, delta: 180deg - 60deg, anchor: "origin", radius: .3)
circle((-0.15, 0.15), radius: .1, fill: white)
circle((-0.10, 0.10), radius: .025, fill: black)
circle(( 0.15, 0.15), radius: .1, fill: white)
circle(( 0.20, 0.10), radius: .025, fill: black)
anchor("tip", ( 0.5, 0))
anchor("base", (-0.5, 0))
})
line((0,0), (3,0), mark: (end: ":)"))
Mark drawing callback, receiving the mark style as argument and returning elements. Format (styles) => elements.
tip:
Tip coordinate (if passed a number, the y component is 0)
base:
Base coordinate (see tip)
center:
Center coordinate (see tip)
reverse-tip:
Reversed tip coordinate (see tip)
reverse-base:
Reversed base coordinate (see tip)
reverse-center:
Reversed center coordinate (see tip)