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 { if comment != none {
h = calc.max(h, measure(comment).height / 1pt + 6) h = calc.max(h, measure(comment).height / 1pt + 6)
} }
if "linked-note" in seq { h = calc.max(
h = calc.max(h, note.get-size(seq.linked-note).height / 2) h,
} ..seq.linked-notes.map(n => {
note.get-size(n).height / 2
})
)
ctx.y -= h ctx.y -= h
let start-info = ( let start-info = (
@ -165,9 +168,8 @@
) )
let y0 = start-info.y let y0 = start-info.y
if "linked-note" in seq { for n in seq.linked-notes {
// TODO: adapt note.render (n.draw)(n, y: start-info.y, forced: true)
(seq.linked-note.draw)(seq.linked-note, y: start-info.y, forced: true)
} }
let flip-mark = end-info.i <= start-info.i let flip-mark = end-info.i <= start-info.i
@ -348,9 +350,14 @@
ctx.lifelines.at(i2) = dst-line ctx.lifelines.at(i2) = dst-line
} }
if "linked-note" in seq { if seq.linked-notes.len() != 0 {
let m = note.get-size(seq.linked-note) end-info.y = calc.min(
end-info.y = calc.min(end-info.y, y0 - m.height / 2) end-info.y,
y0 - calc.max(..seq.linked-notes.map(n => {
let m = note.get-size(n)
return m.height / 2
}))
)
} }
set-ctx(c => { set-ctx(c => {

View File

@ -141,8 +141,8 @@
note.pos = pars.last().last() note.pos = pars.last().last()
} }
let seq = ctx.last-seq.seq let seq = ctx.elmts.at(ctx.last-seq.i)
seq.insert("linked-note", note) seq.linked-notes.push(note)
ctx.elmts.at(ctx.last-seq.i) = seq ctx.elmts.at(ctx.last-seq.i) = seq
} }
if note.aligned { if note.aligned {

View File

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