added sequences with same endpoints
This commit is contained in:
parent
adc50124ad
commit
0e0be4e76a
Binary file not shown.
@ -66,3 +66,9 @@ Alice <-- Bob: Another authentication Response
|
|||||||
_seq("Alice", "Bob", comment: "message 3")
|
_seq("Alice", "Bob", comment: "message 3")
|
||||||
_seq("Bob", "Alice", comment: "ok", dashed: true)
|
_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")
|
||||||
|
})
|
@ -7,7 +7,8 @@
|
|||||||
comment: none,
|
comment: none,
|
||||||
dashed: false,
|
dashed: false,
|
||||||
tip: "default",
|
tip: "default",
|
||||||
color: black
|
color: black,
|
||||||
|
flip: false
|
||||||
) = {
|
) = {
|
||||||
return ((
|
return ((
|
||||||
type: "seq",
|
type: "seq",
|
||||||
@ -17,6 +18,7 @@
|
|||||||
dashed: dashed,
|
dashed: dashed,
|
||||||
tip: tip,
|
tip: tip,
|
||||||
color: color,
|
color: color,
|
||||||
|
flip: flip
|
||||||
),)
|
),)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,6 +133,29 @@
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
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 {
|
if elmt.comment != none {
|
||||||
let x = calc.min(x1, x2)
|
let x = calc.min(x1, x2)
|
||||||
if x2 < x1 {
|
if x2 < x1 {
|
||||||
@ -152,7 +175,9 @@
|
|||||||
(x2, y),
|
(x2, y),
|
||||||
..style
|
..style
|
||||||
)
|
)
|
||||||
|
}
|
||||||
y -= Y-SPACE
|
y -= Y-SPACE
|
||||||
|
|
||||||
} else if elmt.type == "grp" {
|
} else if elmt.type == "grp" {
|
||||||
let m = measure(
|
let m = measure(
|
||||||
box(
|
box(
|
||||||
|
Loading…
Reference in New Issue
Block a user