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

@ -1,6 +1,7 @@
#import "@preview/cetz:0.2.2": draw
#import "consts.typ": *
#import "participant.typ"
#import "note.typ"
#let get-arrow-marks(sym, color) = {
if type(sym) == array {
@ -61,10 +62,15 @@
y -= Y-SPACE
let h = 0
// Reserve space for comment
if elmt.comment != none {
y -= measure(box(elmt.comment)).height / 1pt + 6
h = calc.max(h, measure(box(elmt.comment)).height / 1pt + 6)
}
if "linked-note" in elmt {
h = calc.max(h, note.get-size(elmt.linked-note).height / 2)
}
y -= h
let i1 = pars-i.at(elmt.p1)
let i2 = pars-i.at(elmt.p2)
@ -148,6 +154,12 @@
)
)
let y0 = y
if "linked-note" in elmt {
let shps = note.render(pars-i, x-pos, elmt.linked-note, y, lifelines).last()
shapes += shps
}
if elmt.p1 == elmt.p2 {
if elmt.flip {
x1 = start-info.lx
@ -210,6 +222,11 @@
lifelines.at(i2) = dst-line
}
if "linked-note" in elmt {
let m = note.get-size(elmt.linked-note)
y = calc.min(y, y0 - m.height / 2)
}
let r = (y, lifelines, shapes)
return r
}