added notes

This commit is contained in:
2024-06-21 15:59:35 +02:00
parent 81871e2aca
commit f08f30b9e2
9 changed files with 384 additions and 10 deletions

View File

@ -6,6 +6,7 @@
#import "sequence.typ"
#import "separator.typ"
#import "consts.typ": *
#import "note.typ" as note: get-note-box
#let DEBUG-INVISIBLE = false
@ -61,6 +62,29 @@
par.max-lifelines = calc.max(par.max-lifelines, par.lifeline-lvl)
}
participants.at(i) = par
} else if elmt.type == "note" {
let (p1, p2) = (none, none)
if elmt.side == "left" {
p1 = "["
p2 = elmt.pos
} else if elmt.side == "right" {
p1 = elmt.pos
p2 = "]"
}
if p1 != none and p2 != none {
let i1 = pars-i.at(p1)
let i2 = pars-i.at(p2)
cells.push(
(
elmt: elmt,
i1: i1,
i2: i2,
cell: get-note-box(elmt)
)
)
}
}
}
@ -143,6 +167,7 @@
let draw-group = group.render.with()
let draw-sep = separator.render.with(x-pos)
let draw-par = participant.render.with(x-pos)
let draw-note = note.render.with(pars-i, x-pos)
// Draw participants (start)
for p in participants {
@ -223,6 +248,15 @@
line.lines.push(("create", y))
}
lifelines.at(i) = line
// Note
} else if elmt.type == "note" {
if not elmt.linked {
y -= Y-SPACE
let shps
(y, shps) = draw-note(elmt, y, lifelines)
shapes += shps
}
}
}