added delay function
This commit is contained in:
@ -322,6 +322,26 @@
|
||||
// Gap
|
||||
} else if elmt.type == "gap" {
|
||||
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
|
||||
} else if elmt.type == "evt" {
|
||||
@ -435,6 +455,28 @@
|
||||
if event == "destroy" {
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user