fixed ignored multiple linked notes

This commit is contained in:
2025-07-16 17:21:20 +02:00
parent 1f24ba8efe
commit 8ee14167de
3 changed files with 20 additions and 12 deletions

View File

@ -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 => {

View File

@ -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 {

View File

@ -38,7 +38,8 @@
disable-src: disable-src,
destroy-src: destroy-src,
lifeline-style: lifeline-style,
slant: slant
slant: slant,
linked-notes: ()
),)
}