Release 0.2.0 #5
2
TODO.md
2
TODO.md
@ -23,6 +23,6 @@
|
|||||||
- [ ] PlantUML parser
|
- [ ] PlantUML parser
|
||||||
- [ ] (Message numbering)
|
- [ ] (Message numbering)
|
||||||
- [ ] Mainframes
|
- [ ] Mainframes
|
||||||
- [ ] Different types of groups (alt/loop/etc.)
|
- [x] Different types of groups (alt/loop/etc.)
|
||||||
- [ ] Delays
|
- [ ] Delays
|
||||||
- [ ] Auto-fit in parent
|
- [ ] Auto-fit in parent
|
Binary file not shown.
@ -78,6 +78,15 @@ Alice <-- Bob: Another authentication Response
|
|||||||
_seq("Bob", "Alice", comment: "another authentication Response", dashed: true)
|
_seq("Bob", "Alice", comment: "another authentication Response", dashed: true)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
#chronos.diagram({
|
||||||
|
import chronos: *
|
||||||
|
_seq("Alice", "Bob", comment: "Authentication Request")
|
||||||
|
_delay()
|
||||||
|
_seq("Bob", "Alice", comment: "Authentication Response")
|
||||||
|
_delay(name: "5 minutes later")
|
||||||
|
_seq("Bob", "Alice", comment: "Good Bye !")
|
||||||
|
})
|
||||||
|
|
||||||
#chronos.diagram({
|
#chronos.diagram({
|
||||||
import chronos: *
|
import chronos: *
|
||||||
_seq("Alice", "Bob", comment: "message 1")
|
_seq("Alice", "Bob", comment: "message 1")
|
||||||
|
@ -4,6 +4,6 @@
|
|||||||
#import "sequence.typ": _seq, _ret
|
#import "sequence.typ": _seq, _ret
|
||||||
#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, _delay
|
||||||
#import "note.typ": _note
|
#import "note.typ": _note
|
||||||
#import "sync.typ": _sync
|
#import "sync.typ": _sync
|
@ -323,6 +323,26 @@
|
|||||||
} else if elmt.type == "gap" {
|
} else if elmt.type == "gap" {
|
||||||
y -= elmt.size
|
y -= elmt.size
|
||||||
|
|
||||||
|
// Delay
|
||||||
|
} else if elmt.type == "delay" {
|
||||||
|
let y0 = y
|
||||||
|
let y1 = y - elmt.size
|
||||||
|
for (i, line) in lifelines.enumerate() {
|
||||||
|
line.lines.push(("delay-start", y0))
|
||||||
|
line.lines.push(("delay-end", y1))
|
||||||
|
lifelines.at(i) = line
|
||||||
|
}
|
||||||
|
if elmt.name != none {
|
||||||
|
let x0 = x-pos.first()
|
||||||
|
let x1 = x-pos.last()
|
||||||
|
shapes += draw.content(
|
||||||
|
((x0 + x1) / 2, (y0 + y1) / 2),
|
||||||
|
anchor: "center",
|
||||||
|
elmt.name
|
||||||
|
)
|
||||||
|
}
|
||||||
|
y = y1
|
||||||
|
|
||||||
// Event
|
// Event
|
||||||
} else if elmt.type == "evt" {
|
} else if elmt.type == "evt" {
|
||||||
let par-name = elmt.participant
|
let par-name = elmt.participant
|
||||||
@ -435,6 +455,28 @@
|
|||||||
if event == "destroy" {
|
if event == "destroy" {
|
||||||
destructions.push((x + lvl * LIFELINE-W / 2, line.at(1)))
|
destructions.push((x + lvl * LIFELINE-W / 2, line.at(1)))
|
||||||
}
|
}
|
||||||
|
} else if event == "delay-start" {
|
||||||
|
draw.line(
|
||||||
|
(x, last-y),
|
||||||
|
(x, line.at(1)),
|
||||||
|
stroke: (
|
||||||
|
dash: "dashed",
|
||||||
|
paint: gray.darken(40%),
|
||||||
|
thickness: .5pt
|
||||||
|
)
|
||||||
|
)
|
||||||
|
last-y = line.at(1)
|
||||||
|
} else if event == "delay-end" {
|
||||||
|
draw.line(
|
||||||
|
(x, last-y),
|
||||||
|
(x, line.at(1)),
|
||||||
|
stroke: (
|
||||||
|
dash: "loosely-dotted",
|
||||||
|
paint: gray.darken(40%),
|
||||||
|
thickness: .8pt
|
||||||
|
)
|
||||||
|
)
|
||||||
|
last-y = line.at(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,6 +8,14 @@
|
|||||||
),)
|
),)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#let _delay(name: none, size: 30) = {
|
||||||
|
return ((
|
||||||
|
type: "delay",
|
||||||
|
name: name,
|
||||||
|
size: size
|
||||||
|
),)
|
||||||
|
}
|
||||||
|
|
||||||
#let render(x-pos, elmt, y) = {
|
#let render(x-pos, elmt, y) = {
|
||||||
let shapes = ()
|
let shapes = ()
|
||||||
y -= Y-SPACE
|
y -= Y-SPACE
|
||||||
|
Loading…
Reference in New Issue
Block a user