diff --git a/src/core/draw/delay.typ b/src/core/draw/delay.typ index 006a65a..ecaec15 100644 --- a/src/core/draw/delay.typ +++ b/src/core/draw/delay.typ @@ -24,7 +24,7 @@ let y1 = ctx.y - size for (i, line) in ctx.lifelines.enumerate() { line.events.push((type: "delay-start", y: y0)) - line.events.push((type: "delay-end", y: y1, stroke: style.stroke)) + line.events.push((type: "delay-end", y: y1, style: style)) ctx.lifelines.at(i) = line } if delay.name != none { diff --git a/src/core/draw/event.typ b/src/core/draw/event.typ index 15ab0cc..5dc3bcc 100644 --- a/src/core/draw/event.typ +++ b/src/core/draw/event.typ @@ -1,18 +1,26 @@ +#import "/src/cetz.typ": styles + #import "/src/consts.typ": * #import "/src/core/utils.typ": get-ctx, set-ctx #let render(evt) = get-ctx(ctx => { + let style = styles.resolve( + ctx.style, + merge: evt.style, + root: "event", + base: () + ) + let par-name = evt.participant let i = ctx.pars-i.at(par-name) let par = ctx.participants.at(i) let line = ctx.lifelines.at(i) - let entry = (type: evt.event, y: ctx.y) + let entry = (type: evt.event, y: ctx.y, style: style) if evt.event == "disable" { line.level -= 1 } else if evt.event == "enable" { line.level += 1 - entry.insert("style", evt.lifeline-style) } else if evt.event == "create" { ctx.y -= CREATE-OFFSET entry.y = ctx.y diff --git a/src/core/draw/participant.typ b/src/core/draw/participant.typ index 5732815..6d3edce 100644 --- a/src/core/draw/participant.typ +++ b/src/core/draw/participant.typ @@ -156,7 +156,7 @@ draw.line( (x, last-y), (x, event.y), - stroke: event.stroke + stroke: event.style.stroke ) last-y = event.y } diff --git a/src/misc.typ b/src/misc.typ index 4dce7d1..5d01075 100644 --- a/src/misc.typ +++ b/src/misc.typ @@ -43,13 +43,13 @@ ),) } -#let _evt(participant, event) = { +#let _evt(participant, event, ..style) = { return (( type: "evt", draw: evt-render, participant: participant, event: event, - lifeline-style: auto + style: style.named() ),) }