added some styling options
This commit is contained in:
parent
14cbda2ffb
commit
974eb92159
Binary file not shown.
@ -12,8 +12,14 @@ Alice <-- Bob: Another authentication Response
|
||||
#chronos.diagram({
|
||||
import "/src/diagram.typ": *
|
||||
_seq("Alice", "Bob", comment: "Authentication Request")
|
||||
_seq("Bob", "Alice", comment: "Authentication Response", style: "dashed")
|
||||
_seq("Bob", "Alice", comment: "Authentication Response", dashed: true)
|
||||
|
||||
_seq("Alice", "Bob", comment: "Another authentication Request")
|
||||
_seq("Bob", "Alice", comment: "Another authentication Response", style: "dashed")
|
||||
_seq("Bob", "Alice", comment: "Another authentication Response", dashed: true)
|
||||
})
|
||||
|
||||
#chronos.diagram({
|
||||
import "/src/diagram.typ": *
|
||||
_seq("Bob", "Alice", comment: "bonjour", color: red)
|
||||
_seq("Alice", "Bob", comment: "ok", color: blue)
|
||||
})
|
@ -1,12 +1,21 @@
|
||||
#import "renderer.typ": render
|
||||
|
||||
#let _seq(p1, p2, comment: none, style: auto) = {
|
||||
#let _seq(
|
||||
p1,
|
||||
p2,
|
||||
comment: none,
|
||||
dashed: false,
|
||||
tip: "default",
|
||||
color: black
|
||||
) = {
|
||||
return ((
|
||||
type: "seq",
|
||||
p1: p1,
|
||||
p2: p2,
|
||||
comment: comment,
|
||||
style: style
|
||||
dashed: dashed,
|
||||
tip: tip,
|
||||
color: color,
|
||||
),)
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#import "@preview/cetz:0.2.2": canvas, draw
|
||||
|
||||
#let X-SPACE = 2
|
||||
#let Y-SPACE = 30
|
||||
#let Y-SPACE = 20
|
||||
|
||||
#let get-participants-i(participants) = {
|
||||
let pars-i = (:)
|
||||
@ -69,10 +69,18 @@
|
||||
if elmt.type == "seq" {
|
||||
let x1 = x-pos.at(pars-i.at(elmt.p1))
|
||||
let x2 = x-pos.at(pars-i.at(elmt.p2))
|
||||
let style = (
|
||||
mark: (end: "straight"),
|
||||
stroke: (
|
||||
dash: if elmt.dashed {"dashed"} else {"solid"},
|
||||
paint: elmt.color
|
||||
)
|
||||
)
|
||||
|
||||
draw.line(
|
||||
(x1, y),
|
||||
(x2, y),
|
||||
mark: (end: "straight")
|
||||
..style
|
||||
)
|
||||
if elmt.comment != none {
|
||||
draw.content(
|
||||
|
Loading…
Reference in New Issue
Block a user