Marks
Marks are arrow tips that can be added to the end of path based elements that support the mark
style key, or can be directly drawn by using the mark
draw function. Marks are specified by giving their names (or shorthand) as strings and have several options to customise them. You can give an array of names to have multiple marks, and dictionaries can be used in the array for per mark styling.
let c = ((rel: (0, -1)), (rel: (2, 0), update: false)) // Coordinates to draw the line, it is not necessary to understand this for this example.
// No marks
line((), (rel: (1, 0), update: false))
// Draws a triangle mark at both ends of the line.
set-style(mark: (symbol: ">"))
line(..c)
// Overrides the end mark to be a diamond but the start is still a triangle.
set-style(mark: (end: "<>"))
line(..c)
// Draws two triangle marks at both ends but the first mark of end is still a diamond.
set-style(mark: (symbol: (">", ">")))
line(..c)
// Sets the stroke of first mark in the sequence to red but the end mark overrides it to be blue.
set-style(mark: (symbol: ((symbol: ">", stroke: red), ">"), end: (stroke: blue)))
line(..c)
symbol:
none
This option sets the mark to draw when using the mark
draw function, or
applies styling to both mark ends of path based elements. The mark's name or
shorthand can be given. Multiple marks can be drawn by passing an array of
names or shorthands. When none
, no marks will be drawn. A style
dictionary can be given instead of a str to override
styling for that particular mark, just make sure to still give the mark name
using the symbol
key otherwise nothing will be drawn!
start:
none
This option sets the mark to draw at the start of a path based element. It
will override all options of the symbol
key and will not affect marks drawn
using the mark
draw function.
end:
none
Like start
but for the mark at the end of a path.
It specifies a distance by which something inside the arrow tip is set inwards; for the stealth arrow tip it is the distance by which the back angle is moved inwards.
Only applicable when marks are used on curves such as bezier and hobby. If true, the mark will point along the secant of the curve. If false, the tangent at the mark's tip will be used.
Only applicable when marks are used on curves such as bezier and hobby. The maximum number of samples to use for calculating curve positions. A higher number gives better results but may slow down compilation
Overrides the mark's position along a path. A number will move it an absolute distance, while a ratio will be a distance relative to the length of the path. Note that this may be removed in the future in preference of a different method.
Like pos
but it advances the position of the mark instead of overriding it.
How much to slant the mark relative to the axis of the arrow. 0% means no slant 100% slants at 45 degrees.
Which mark to shorten the path to when multiple marks are given. auto
will
shorten to the last mark, none
will shorten to the first mark (effectively
disabling path shortening). An integer can be given to select the mark's
index.