fixed new participants not detected in syncs

fixes #20
This commit is contained in:
2026-01-21 16:17:23 +01:00
parent 34ec00768f
commit 4231233f76
3 changed files with 63 additions and 40 deletions

View File

@@ -2,6 +2,7 @@
#import "draw/note.typ": get-box as get-note-box, get-size as get-note-size
#import "draw/participant.typ"
#import "draw/sync.typ": in-sync-render
#import "utils.typ": *
#import "/src/consts.typ": *
@@ -15,22 +16,6 @@
})
}
#let unwrap-syncs(elements) = {
let i = 0
while i < elements.len() {
let elmt = elements.at(i)
if elmt.type == "sync" {
elements = (
elements.slice(0, i + 1) +
elmt.elmts +
elements.slice(i + 1)
)
}
i += 1
}
return elements
}
#let seq-update-lifelines(participants, pars-i, seq) = {
let participants = participants
let com = if seq.comment == none {""} else {seq.comment}
@@ -308,7 +293,6 @@
#let compute-columns-width(participants, elements, pars-i) = {
elements = elements.filter(is-elmt)
elements = unwrap-syncs(elements)
let cells
(participants, elements, cells) = compute-max-lifeline-levels(participants, elements, pars-i)
@@ -334,7 +318,8 @@
lifelines: participants.map(_ => (
level: 0,
lines: ()
))
)),
in-sync: false
)
chronos-ctx.insert(
"widths",
@@ -393,7 +378,13 @@
if not is-elmt(elmt) {
(elmt,)
} else if "draw" in elmt and elmt.type != "par" {
(elmt.draw)(elmt)
get-ctx(ctx => {
if ctx.in-sync and elmt.type != "sync-end" {
in-sync-render(elmt)
} else {
(elmt.draw)(elmt)
}
})
}
}