From 6615cd2600c69b73c6b01e5afbd0ba39ffc066ef Mon Sep 17 00:00:00 2001 From: LordBaryhobal Date: Mon, 14 Jul 2025 17:29:51 +0200 Subject: [PATCH] refactored debug rendering --- src/core/renderer.typ | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/src/core/renderer.typ b/src/core/renderer.typ index 8081885..4f604d8 100644 --- a/src/core/renderer.typ +++ b/src/core/renderer.typ @@ -353,6 +353,24 @@ ) },) +#let render-debug() = get-ctx(ctx => { + for p in ctx.participants.filter(p => p.invisible) { + let color = if p.name.starts-with("?") {green} else if p.name.ends-with("?") {red} else {blue} + let x = ctx.x-pos.at(p.i) + draw.line( + (x, 0), + (x, ctx.y), + stroke: (paint: color, dash: "dotted") + ) + draw.content( + (x, 0), + p.display-name, + anchor: "west", + angle: 90deg + ) + } +}) + #let render(participants, elements) = context canvas(length: 1pt, { setup-ctx(participants, elements) @@ -379,24 +397,9 @@ return ctx }) - // Draw vertical lines + lifelines + end participants draw.on-layer(-1, { if DEBUG-INVISIBLE { - for p in participants.filter(p => p.invisible) { - let color = if p.name.starts-with("?") {green} else if p.name.ends-with("?") {red} else {blue} - let x = x-pos.at(p.i) - draw.line( - (x, 0), - (x, y), - stroke: (paint: color, dash: "dotted") - ) - draw.content( - (x, 0), - p.display-name, - anchor: "west", - angle: 90deg - ) - } + render-debug() } participant.render-lifelines()