refactored sequences, sync and gaps

This commit is contained in:
2025-07-14 16:30:25 +02:00
parent 12fb144039
commit 3cc600d058
10 changed files with 849 additions and 401 deletions

31
src/core/draw/event.typ Normal file
View File

@ -0,0 +1,31 @@
#import "../utils.typ": get-ctx, set-ctx
#import "../../consts.typ": *
#let render(evt) = get-ctx(ctx => {
let par-name = evt.participant
let i = ctx.pars-i.at(par-name)
let par = ctx.participants.at(i)
let line = ctx.lifelines.at(i)
let entry = (evt.event, ctx.y)
if evt.event == "disable" {
line.level -= 1
} else if evt.event == "enable" {
line.level += 1
entry.push(evt.lifeline-style)
} else if evt.event == "create" {
ctx.y -= CREATE-OFFSET
entry.at(1) = ctx.y
(par.draw)(par)
} else if evt.event == "destroy" {
} else {
panic("Unknown event '" + evt.event + "'")
}
line.lines.push(entry)
set-ctx(c => {
c.lifelines.at(i) = line
c.y = ctx.y
return c
})
})