Compare commits

..

No commits in common. "c4f09a0a3e9084cc8d456200856ddb8a5fc84854" and "3bc103b9d754fc788ec098a57e71627893785f55" have entirely different histories.

5 changed files with 5 additions and 64 deletions

View File

@ -1,7 +1,6 @@
#import "utils.typ": get-group-span, fit-canvas #import "utils.typ": get-group-span, fit-canvas
#import "renderer.typ": render #import "renderer.typ": render
#import "participant.typ" as participant: _par, PAR-SPECIALS #import "participant.typ" as participant: _par, PAR-SPECIALS
#import "sequence.typ": _seq
#let _gap(size: 20) = { #let _gap(size: 20) = {
return (( return ((
@ -39,9 +38,7 @@
let elmts = elements let elmts = elements
let i = 0 let i = 0
let activation-history = () // Flatten groups
// Flatten groups + convert returns
while i < elmts.len() { while i < elmts.len() {
let elmt = elmts.at(i) let elmt = elmts.at(i)
if elmt.type == "grp" { if elmt.type == "grp" {
@ -65,30 +62,6 @@
),) + ),) +
elmts.slice(i+1) elmts.slice(i+1)
) )
} else if elmt.type == "seq" {
if elmt.enable-dst {
activation-history.push(elmt)
}
} else if elmt.type == "evt" {
if elmt.event == "enable" {
for elmt2 in elmts.slice(0, i).rev() {
if elmt2.type == "seq" {
activation-history.push(elmt2)
break
}
}
}
} else if elmt.type == "ret" {
if activation-history.len() == 0 {
panic("Cannot return if no lifeline is activated")
}
let seq = activation-history.pop()
elmts.at(i) = _seq(
seq.p2, seq.p1,
comment: elmt.comment,
disable-src: true,
dashed: true
).first()
} }
i += 1 i += 1
} }
@ -157,21 +130,6 @@
} else if elmt.side == "right" { } else if elmt.side == "right" {
linked.push("]") linked.push("]")
} }
let pars = none
if type(elmt.pos) == str {
pars = (elmt.pos,)
} else if type(elmt.pos) == array {
pars = elmt.pos
}
if pars != none {
for par in pars {
if not participant._exists(participants, par) {
participants.push(_par(par).first())
}
}
}
last-note = ( last-note = (
elmt: elmt, elmt: elmt,
i: i i: i

View File

@ -1,7 +1,7 @@
#let version = version(0, 1, 1) #let version = version(0, 1, 1)
#import "diagram.typ": diagram, from-plantuml, _gap, _evt, _col #import "diagram.typ": diagram, from-plantuml, _gap, _evt, _col
#import "sequence.typ": _seq, _ret #import "sequence.typ": _seq
#import "group.typ": _grp, _loop, _alt, _opt, _break #import "group.typ": _grp, _loop, _alt, _opt, _break
#import "participant.typ": _par #import "participant.typ": _par
#import "separator.typ": _sep #import "separator.typ": _sep

View File

@ -25,9 +25,6 @@
panic("Aligned notes can only be over a participant (got side '" + side + "')") panic("Aligned notes can only be over a participant (got side '" + side + "')")
} }
} }
if color == auto {
color = COL-NOTE
}
return (( return ((
type: "note", type: "note",
side: side, side: side,

View File

@ -13,7 +13,6 @@
"queue", "queue",
"custom" "custom"
) )
#let DEFAULT-COLOR = rgb("#E2E2F0")
#let _par( #let _par(
name, name,
@ -21,14 +20,11 @@
from-start: true, from-start: true,
invisible: false, invisible: false,
shape: "participant", shape: "participant",
color: DEFAULT-COLOR, color: rgb("#E2E2F0"),
custom-image: none, custom-image: none,
show-bottom: true, show-bottom: true,
show-top: true, show-top: true,
) = { ) = {
if color == auto {
color = DEFAULT-COLOR
}
return (( return ((
type: "par", type: "par",
name: name, name: name,

View File

@ -4,9 +4,6 @@
#import "note.typ" #import "note.typ"
#let get-arrow-marks(sym, color) = { #let get-arrow-marks(sym, color) = {
if sym == none {
return none
}
if type(sym) == array { if type(sym) == array {
return sym.map(s => get-arrow-marks(s, color)) return sym.map(s => get-arrow-marks(s, color))
} }
@ -88,13 +85,6 @@
),) ),)
} }
#let _ret(comment: none) = {
return ((
type: "ret",
comment: comment
),)
}
#let render(pars-i, x-pos, participants, elmt, y, lifelines) = { #let render(pars-i, x-pos, participants, elmt, y, lifelines) = {
let shapes = () let shapes = ()
@ -304,7 +294,7 @@
// Start circle tip // Start circle tip
if is-circle-tip(elmt.start-tip) { if is-circle-tip(elmt.start-tip) {
shapes += draw.circle(pts.first(), radius: CIRCLE-TIP-RADIUS, stroke: none, fill: elmt.color, name: "_circle-start-tip") shapes += draw.circle(pts.first(), radius: CIRCLE-TIP-RADIUS, stroke: elmt.color, fill: none, name: "_circle-start-tip")
pts.at(0) = "_circle-start-tip" pts.at(0) = "_circle-start-tip"
// Start cross tip // Start cross tip
@ -326,7 +316,7 @@
// End circle tip // End circle tip
if is-circle-tip(elmt.end-tip) { if is-circle-tip(elmt.end-tip) {
shapes += draw.circle(pts.last(), radius: 3, stroke: none, fill: elmt.color, name: "_circle-end-tip") shapes += draw.circle(pts.last(), radius: 3, stroke: elmt.color, fill: none, name: "_circle-end-tip")
pts.at(pts.len() - 1) = "_circle-end-tip" pts.at(pts.len() - 1) = "_circle-end-tip"
// End cross tip // End cross tip