refactored sequences, sync and gaps

This commit is contained in:
2025-07-14 16:30:25 +02:00
parent 12fb144039
commit 3cc600d058
10 changed files with 849 additions and 401 deletions

32
src/core/draw/sync.typ Normal file
View File

@ -0,0 +1,32 @@
#import "../utils.typ": get-ctx, set-ctx, is-elmt
#let render(sync) = get-ctx(ctx => {
set-ctx(c => {
c.sync-ys = ()
return c
})
for e in sync.elmts {
assert(is-elmt(e), message: "Sync element can only contain chronos elements, found " + repr(e))
assert(
e.type == "seq",
message: "Sync element can only contain sequences, found '" + e.type + "'"
)
set-ctx(c => {
c.y = ctx.y
return c
})
(e.draw)(e)
set-ctx(c => {
c.sync-ys.push(c.y)
return c
})
}
set-ctx(c => {
c.y = calc.min(..c.sync-ys)
c.remove("sync-ys")
return c
})
})