added show-top / -bottom options to participants

This commit is contained in:
Louis Heredero 2024-08-20 23:19:43 +02:00
parent b9bbe6f93d
commit eb05c41810
Signed by: HEL
GPG Key ID: 8D83DE470F8544E7
4 changed files with 22 additions and 5 deletions

Binary file not shown.

View File

@ -134,3 +134,14 @@ chronos.diagram({
_seq("a", "a", start-tip: "x", end-tip: ("o", ">"), comment: `x->o`)
})
)
#chronos.diagram({
import chronos: *
_par("a", display-name: "Alice")
_par("b", display-name: "Bob", show-bottom: false)
_par("c", display-name: "Caleb", show-top: false)
_par("d", display-name: "Danny", show-bottom: false, show-top: false)
_gap()
})

View File

@ -21,7 +21,9 @@
invisible: false,
shape: "participant",
color: rgb("#E2E2F0"),
custom-image: none
custom-image: none,
show-bottom: true,
show-top: true,
) = {
return ((
type: "par",
@ -31,7 +33,9 @@
invisible: invisible,
shape: shape,
color: color,
custom-image: custom-image
custom-image: custom-image,
show-bottom: show-bottom,
show-top: show-top
),)
}

View File

@ -218,7 +218,7 @@
// Draw participants (start)
for p in participants {
if p.from-start and not p.invisible {
if p.from-start and not p.invisible and p.show-top {
shapes += draw-par(p)
}
}
@ -417,8 +417,10 @@
}
// Draw participants (end)
if p.show-bottom {
draw-par(p, y: y, bottom: true)
}
}
})
shapes