diff --git a/src/core/draw/sequence.typ b/src/core/draw/sequence.typ index 0d0ae47..49103e6 100644 --- a/src/core/draw/sequence.typ +++ b/src/core/draw/sequence.typ @@ -67,9 +67,12 @@ if comment != none { h = calc.max(h, measure(comment).height / 1pt + 6) } - if "linked-note" in seq { - h = calc.max(h, note.get-size(seq.linked-note).height / 2) - } + h = calc.max( + h, + ..seq.linked-notes.map(n => { + note.get-size(n).height / 2 + }) + ) ctx.y -= h let start-info = ( @@ -165,9 +168,8 @@ ) let y0 = start-info.y - if "linked-note" in seq { - // TODO: adapt note.render - (seq.linked-note.draw)(seq.linked-note, y: start-info.y, forced: true) + for n in seq.linked-notes { + (n.draw)(n, y: start-info.y, forced: true) } let flip-mark = end-info.i <= start-info.i @@ -348,9 +350,14 @@ ctx.lifelines.at(i2) = dst-line } - if "linked-note" in seq { - let m = note.get-size(seq.linked-note) - end-info.y = calc.min(end-info.y, y0 - m.height / 2) + if seq.linked-notes.len() != 0 { + end-info.y = calc.min( + end-info.y, + y0 - calc.max(..seq.linked-notes.map(n => { + let m = note.get-size(n) + return m.height / 2 + })) + ) } set-ctx(c => { diff --git a/src/core/setup.typ b/src/core/setup.typ index 81b2a74..7873526 100644 --- a/src/core/setup.typ +++ b/src/core/setup.typ @@ -141,8 +141,8 @@ note.pos = pars.last().last() } - let seq = ctx.last-seq.seq - seq.insert("linked-note", note) + let seq = ctx.elmts.at(ctx.last-seq.i) + seq.linked-notes.push(note) ctx.elmts.at(ctx.last-seq.i) = seq } if note.aligned { diff --git a/src/sequence.typ b/src/sequence.typ index c99df3a..a328f4a 100644 --- a/src/sequence.typ +++ b/src/sequence.typ @@ -38,7 +38,8 @@ disable-src: disable-src, destroy-src: destroy-src, lifeline-style: lifeline-style, - slant: slant + slant: slant, + linked-notes: () ),) }