Compare commits

..

No commits in common. "0e0be4e76ad78481f14908784bdcc14dcd5ff06e" and "b8d0c3468cd42654fcc6df5cdfc44e99fb76092f" have entirely different histories.

4 changed files with 15 additions and 74 deletions

Binary file not shown.

View File

@ -53,22 +53,4 @@ Alice <-- Bob: Another authentication Response
_sep("Repetition")
_seq("Alice", "Bob", comment: "Another authentication Request")
_seq("Bob", "Alice", comment: "another authentication Response", dashed: true)
})
#chronos.diagram({
import "/src/diagram.typ": *
_seq("Alice", "Bob", comment: "message 1")
_seq("Bob", "Alice", comment: "ok", dashed: true)
_gap()
_seq("Alice", "Bob", comment: "message 2")
_seq("Bob", "Alice", comment: "ok", dashed: true)
_gap(size: 45)
_seq("Alice", "Bob", comment: "message 3")
_seq("Bob", "Alice", comment: "ok", dashed: true)
})
#chronos.diagram({
import "/src/diagram.typ": *
_seq("Alice", "Alice", comment: "On the\nright")
_seq("Alice", "Alice", flip: true, comment: "On the\nleft")
})

View File

@ -7,8 +7,7 @@
comment: none,
dashed: false,
tip: "default",
color: black,
flip: false
color: black
) = {
return ((
type: "seq",
@ -18,7 +17,6 @@
dashed: dashed,
tip: tip,
color: color,
flip: flip
),)
}
@ -57,13 +55,6 @@
),)
}
#let _gap(size: 20) = {
return ((
type: "gap",
size: size
),)
}
#let diagram(elements) = {
let participants = ()
let elmts = elements

View File

@ -4,7 +4,6 @@
#let Y-SPACE = 10
#let PAR-PAD = (5pt, 3pt)
#let PAR-SPACE = 10
#let COMMENT-PAD = 8
#let get-columns-width(participants, elements) = {
@ -39,7 +38,7 @@
let m = measure(cell.cell)
widths.at(cell.i1) = calc.max(
widths.at(cell.i1),
m.width / 1pt + COMMENT-PAD
m.width / 1pt
)
}
@ -133,51 +132,22 @@
)
)
if elmt.p1 == elmt.p2 {
x2 = if elmt.flip {x1 - 20} else {x1 + 20}
if elmt.comment != none {
y -= measure(box(elmt.comment)).height / 1pt + 6
draw.content(
(x1, y),
elmt.comment,
anchor: if elmt.flip {"south-east"} else {"south-west"},
padding: 3pt
)
}
draw.line(
(x1, y),
(x2, y),
(x2, y - 10),
(x1, y - 10),
..style
)
y -= 10
} else {
if elmt.comment != none {
let x = calc.min(x1, x2)
if x2 < x1 {
x += COMMENT-PAD
}
y -= measure(box(elmt.comment)).height / 1pt + 6
draw.content(
(x, y),
elmt.comment,
anchor: "south-west",
padding: 3pt
)
}
draw.line(
(x1, y),
(x2, y),
..style
if elmt.comment != none {
y -= measure(box(elmt.comment)).height / 1pt + 6
draw.content(
(calc.min(x1, x2), y),
elmt.comment,
anchor: "south-west",
padding: 3pt
)
}
y -= Y-SPACE
draw.line(
(x1, y),
(x2, y),
..style
)
y -= Y-SPACE
} else if elmt.type == "grp" {
let m = measure(
box(
@ -230,8 +200,6 @@
)
y -= h / 2
y -= Y-SPACE
} else if elmt.type == "gap" {
y -= elmt.size
}
}