diff --git a/gallery/notes.pdf b/gallery/notes.pdf index bd8fc93..9a0d034 100644 Binary files a/gallery/notes.pdf and b/gallery/notes.pdf differ diff --git a/gallery/notes.typ b/gallery/notes.typ index 7e4ba7e..f7fc8da 100644 --- a/gallery/notes.typ +++ b/gallery/notes.typ @@ -135,4 +135,11 @@ _seq("[", "a", comment: [Test]) _note("left", [This is also a note]) -})*/ \ No newline at end of file +})*/ + +#pagebreak() + +#chronos.diagram({ + _seq("Bob", "Alice", comment: [Hello]) + _evt("Other", "create") +}) \ No newline at end of file diff --git a/src/diagram.typ b/src/diagram.typ index 03c41b8..d34b4d6 100644 --- a/src/diagram.typ +++ b/src/diagram.typ @@ -123,6 +123,16 @@ elmt: elmt, i: i ) + } else if elmt.type == "evt" { + let par = elmt.participant + if not participant._exists(participants, par) { + let p = _par(par, from-start: elmt.event != "create").first() + participants.push(p) + + } else if elmt.event == "create" { + let i = participants.position(p => p.name == par) + participants.at(i).from-start = false + } } } linked = linked.dedup() diff --git a/src/renderer.typ b/src/renderer.typ index 777aa0f..a4ed4bd 100644 --- a/src/renderer.typ +++ b/src/renderer.typ @@ -279,6 +279,7 @@ line.lines.push(("enable", y, elmt.lifeline-style)) } else if elmt.event == "create" { + y -= CREATE-OFFSET shapes += participant.render(x-pos, par, y: y) line.lines.push(("create", y)) }