refactored participant rendering

This commit is contained in:
2025-07-19 17:13:56 +02:00
parent d6aeb33fa5
commit 5b57a89cdd
13 changed files with 592 additions and 337 deletions

View File

@@ -21,6 +21,15 @@
}
panic("Unsupported type '" + str(type(value)) + "'")
}
#let normalize-measure(body) = {
let m = measure(body)
return (
width: normalize-units(m.width),
height: normalize-units(m.height)
)
}
#let get-participants-i(participants) = {
let pars-i = (:)
for (i, p) in participants.enumerate() {
@@ -98,9 +107,19 @@
)
})
#let extract-ctx(cetz-ctx) = {
#let extract-ctx(cetz-ctx, with-style: false) = {
let state = cetz-ctx.at("shared-state", default: (:))
return state.at("chronos", default: (:))
let ctx = state.at("chronos", default: (:))
if with-style {
ctx.style = styles.resolve(
cetz-ctx.style,
root: "chronos",
base: default-style
)
// Normalize because it is used very frequently
ctx.style.y-space = normalize-units(ctx.style.y-space)
}
return ctx
}
#let set-ctx(func) = draw.set-ctx(c => {
@@ -114,14 +133,7 @@
})
#let get-ctx(func) = draw.get-ctx(c => {
let ctx = extract-ctx(c)
ctx.style = styles.resolve(
c.style,
root: "chronos",
base: default-style
)
// Normalize because it is used very frequently
ctx.style.y-space = normalize-units(ctx.style.y-space)
let ctx = extract-ctx(c, with-style: true)
func(ctx)
})