adapted boundary shape rendering

This commit is contained in:
2025-07-19 17:56:57 +02:00
parent c27493e780
commit 02fd3282f7

View File

@ -1,22 +1,23 @@
#import "/src/cetz.typ": draw
#import "/src/core/utils.typ": normalize-measure
#import "/src/consts.typ": *
#import "/src/core/utils.typ": normalize-measure, normalize-units
#let name = "boundary"
#let render(x, y, p, bottom) = {
let m = measure(p.display-name)
let m = normalize-measure(p.display-name)
let style = p.resolved-style
let circle-r = BOUNDARY-HEIGHT / 2
let height = normalize-units(style.height)
let spacing = normalize-units(style.spacing)
let circle-r = height / 2
let y0 = if bottom {
y - m.height / 1pt - SYM-GAP
y - m.height - spacing
} else {
y + m.height / 1pt + BOUNDARY-HEIGHT + SYM-GAP
y + m.height + height + spacing
}
let x0 = x - BOUNDARY-HEIGHT
let x0 = x - height
let y1 = y0 - circle-r
let y2 = y0 - BOUNDARY-HEIGHT
let y2 = y0 - height
draw.circle(
(x + circle-r, y1),
@ -42,12 +43,17 @@
#let get-size(par) = {
let m = normalize-measure(par.display-name)
// BOUNDARY-HEIGHT * 2pt
// BOUNDARY-HEIGHT * 1pt + SYM-GAP * 1pt + h
let height = normalize-units(par.resolved-style.height)
let width = height * 2
let spacing = normalize-units(par.resolved-style.spacing)
return m
return (
width: calc.max(m.width, width),
height: height + spacing + m.height
)
}
#let default-style = (
:
height: 20pt,
spacing: 5pt
)