fix: correctly hide lifelines with _hide

This commit is contained in:
2026-04-07 14:38:51 +02:00
parent 57269ae983
commit e01d180445
2 changed files with 17 additions and 0 deletions

View File

@@ -3,6 +3,9 @@
#let render(sync) = get-ctx(ctx => { #let render(sync) = get-ctx(ctx => {
set-ctx(c => { set-ctx(c => {
c.hidden = true c.hidden = true
for i in range(c.lifelines.len()) {
c.lifelines.at(i).lines.push(("hide",))
}
return c return c
}) })
}) })
@@ -10,6 +13,9 @@
#let render-end(sync) = get-ctx(ctx => { #let render-end(sync) = get-ctx(ctx => {
set-ctx(c => { set-ctx(c => {
c.hidden = false c.hidden = false
for i in range(c.lifelines.len()) {
c.lifelines.at(i).lines.push(("unhide",))
}
return c return c
}) })
}) })

View File

@@ -320,9 +320,20 @@
let destructions = () let destructions = ()
let lines = () let lines = ()
let hidden = false
// Compute lifeline rectangles + destruction positions // Compute lifeline rectangles + destruction positions
for line in ctx.lifelines.at(p.i).lines { for line in ctx.lifelines.at(p.i).lines {
let event = line.first() let event = line.first()
if event == "hide" {
hidden = true
} else if event == "unhide" {
hidden = false
}
if hidden and event in ("create", "enable") {
continue
}
if event == "create" { if event == "create" {
last-y = line.at(1) last-y = line.at(1)