Release 0.2.0 #5

Merged
HEL merged 18 commits from dev into main 2024-11-09 14:00:05 +00:00
Showing only changes of commit ab1386e721 - Show all commits

View File

@ -100,19 +100,27 @@
y -= Y-SPACE y -= Y-SPACE
let i1 = pars-i.at(elmt.p1)
let i2 = pars-i.at(elmt.p2)
let width = calc.abs(x-pos.at(i1) - x-pos.at(i2))
let h = 0 let h = 0
let comment = if elmt.comment == none {none} else {
let w = calc.min(width * 1pt, measure(elmt.comment).width)
box(
width: if i1 == i2 {auto} else {w},
elmt.comment
)
}
// Reserve space for comment // Reserve space for comment
if elmt.comment != none { if comment != none {
h = calc.max(h, measure(box(elmt.comment)).height / 1pt + 6) h = calc.max(h, measure(comment).height / 1pt + 6)
} }
if "linked-note" in elmt { if "linked-note" in elmt {
h = calc.max(h, note.get-size(elmt.linked-note).height / 2) h = calc.max(h, note.get-size(elmt.linked-note).height / 2)
} }
y -= h y -= h
let i1 = pars-i.at(elmt.p1)
let i2 = pars-i.at(elmt.p2)
let start-info = ( let start-info = (
i: i1, i: i1,
x: x-pos.at(i1), x: x-pos.at(i1),
@ -244,7 +252,7 @@
(x2, end-info.y) (x2, end-info.y)
) )
if elmt.comment != none { if comment != none {
comment-anchor = ( comment-anchor = (
start: if x-mid < x1 {"south-east"} else {"south-west"}, start: if x-mid < x1 {"south-east"} else {"south-west"},
end: if x-mid < x1 {"south-west"} else {"south-east"}, end: if x-mid < x1 {"south-west"} else {"south-east"},
@ -268,7 +276,7 @@
(x2, end-info.y) (x2, end-info.y)
) )
if elmt.comment != none { if comment != none {
let start-pt = pts.first() let start-pt = pts.first()
let end-pt = pts.last() let end-pt = pts.last()
if elmt.start-tip != "" { if elmt.start-tip != "" {
@ -348,10 +356,10 @@
shapes += draw.line(..pts, ..style) shapes += draw.line(..pts, ..style)
if elmt.comment != none { if comment != none {
shapes += draw.content( shapes += draw.content(
comment-pt, comment-pt,
elmt.comment, comment,
anchor: comment-anchor, anchor: comment-anchor,
angle: comment-angle, angle: comment-angle,
padding: 3pt padding: 3pt