added participant creation
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
#import "consts.typ": *
|
||||
#import "@preview/cetz:0.2.2": draw
|
||||
#import "consts.typ": *
|
||||
#import "participant.typ"
|
||||
|
||||
#let _seq(
|
||||
p1,
|
||||
@ -36,15 +37,34 @@
|
||||
),)
|
||||
}
|
||||
|
||||
#let render(pars-i, x-pos, elmt, y, lifelines) = {
|
||||
#let render(pars-i, x-pos, participants, elmt, y, lifelines) = {
|
||||
let shapes = ()
|
||||
|
||||
// Reserve space for comment
|
||||
if elmt.comment != none {
|
||||
y -= measure(box(elmt.comment)).height / 1pt + 6
|
||||
}
|
||||
|
||||
let i1 = pars-i.at(elmt.p1)
|
||||
let i2 = pars-i.at(elmt.p2)
|
||||
|
||||
if elmt.comment != none {
|
||||
y -= measure(box(elmt.comment)).height / 1pt + 6
|
||||
}
|
||||
let start-info = (
|
||||
i: i1,
|
||||
x: x-pos.at(i1),
|
||||
y: y,
|
||||
ll-lvl: lifelines.at(i1).level * LIFELINE-W / 2
|
||||
)
|
||||
let end-info = (
|
||||
i: i2,
|
||||
x: x-pos.at(i2),
|
||||
y: y,
|
||||
ll-lvl: lifelines.at(i2).level * LIFELINE-W / 2
|
||||
)
|
||||
|
||||
let ll-lvl1 = lifelines.at(i1).level * LIFELINE-W / 2
|
||||
|
||||
let x1 = x-pos.at(i1)
|
||||
let x2 = x-pos.at(i2)
|
||||
|
||||
if elmt.disable-src {
|
||||
let src-line = lifelines.at(i1)
|
||||
@ -54,23 +74,18 @@
|
||||
}
|
||||
if elmt.destroy-src {
|
||||
let src-line = lifelines.at(i1)
|
||||
src-line.level -= 1
|
||||
src-line.lines.push(("destroy", y, auto))
|
||||
src-line.lines.push(("destroy", y))
|
||||
lifelines.at(i1) = src-line
|
||||
}
|
||||
|
||||
let ll-lvl1 = lifelines.at(i1).level * LIFELINE-W / 2
|
||||
|
||||
if elmt.disable-dst {
|
||||
let dst-line = lifelines.at(i2)
|
||||
dst-line.level -= 1
|
||||
dst-line.lines.push(("disable", y, auto))
|
||||
dst-line.lines.push(("disable", y))
|
||||
lifelines.at(i2) = dst-line
|
||||
}
|
||||
if elmt.destroy-dst {
|
||||
let dst-line = lifelines.at(i2)
|
||||
dst-line.level -= 1
|
||||
dst-line.lines.push(("destroy", y, auto))
|
||||
dst-line.lines.push(("destroy", y))
|
||||
lifelines.at(i2) = dst-line
|
||||
}
|
||||
if elmt.enable-dst {
|
||||
@ -78,10 +93,14 @@
|
||||
dst-line.level += 1
|
||||
lifelines.at(i2) = dst-line
|
||||
}
|
||||
if elmt.create-dst {
|
||||
let par = participants.at(i2)
|
||||
let m = measure(box(par.display-name))
|
||||
x2 -= (m.width + PAR-PAD.last() * 2) / 2pt
|
||||
shapes += participant.render(x-pos, par, y: y)
|
||||
}
|
||||
|
||||
let x1 = x-pos.at(i1)
|
||||
let x2 = x-pos.at(i2)
|
||||
|
||||
end-info.ll-lvl = lifelines.at(i2).level * LIFELINE-W / 2
|
||||
let ll-lvl2 = lifelines.at(i2).level * LIFELINE-W / 2
|
||||
|
||||
let f = if elmt.flip {-1} else {1}
|
||||
|
Reference in New Issue
Block a user