improved seq arrow positioning
This commit is contained in:
parent
a9b467152a
commit
8deb26441d
Binary file not shown.
Binary file not shown.
@ -61,11 +61,6 @@
|
|||||||
ll-lvl: lifelines.at(i2).level * LIFELINE-W / 2
|
ll-lvl: lifelines.at(i2).level * LIFELINE-W / 2
|
||||||
)
|
)
|
||||||
|
|
||||||
let ll-lvl1 = lifelines.at(i1).level * LIFELINE-W / 2
|
|
||||||
|
|
||||||
let x1 = x-pos.at(i1)
|
|
||||||
let x2 = x-pos.at(i2)
|
|
||||||
|
|
||||||
if elmt.disable-src {
|
if elmt.disable-src {
|
||||||
let src-line = lifelines.at(i1)
|
let src-line = lifelines.at(i1)
|
||||||
src-line.level -= 1
|
src-line.level -= 1
|
||||||
@ -96,20 +91,29 @@
|
|||||||
if elmt.create-dst {
|
if elmt.create-dst {
|
||||||
let par = participants.at(i2)
|
let par = participants.at(i2)
|
||||||
let m = measure(box(par.display-name))
|
let m = measure(box(par.display-name))
|
||||||
x2 -= (m.width + PAR-PAD.last() * 2) / 2pt
|
let f = if i1 > i2 {-1} else {1}
|
||||||
|
end-info.x -= (m.width + PAR-PAD.last() * 2) / 2pt * f
|
||||||
shapes += participant.render(x-pos, par, y: y)
|
shapes += participant.render(x-pos, par, y: y)
|
||||||
}
|
}
|
||||||
|
|
||||||
end-info.ll-lvl = lifelines.at(i2).level * LIFELINE-W / 2
|
end-info.ll-lvl = lifelines.at(i2).level * LIFELINE-W / 2
|
||||||
let ll-lvl2 = lifelines.at(i2).level * LIFELINE-W / 2
|
|
||||||
|
|
||||||
let f = if elmt.flip {-1} else {1}
|
// Compute left/right position at start/end
|
||||||
if i1 <= i2 {
|
start-info.insert("lx", start-info.x)
|
||||||
x1 += ll-lvl1 * f
|
if start-info.ll-lvl != 0 { start-info.lx -= LIFELINE-W / 2 }
|
||||||
x2 -= ll-lvl2 * f
|
end-info.insert("lx", end-info.x)
|
||||||
} else {
|
if end-info.ll-lvl != 0 { end-info.lx -= LIFELINE-W / 2 }
|
||||||
x1 -= ll-lvl1 * f
|
|
||||||
x2 += ll-lvl2 * f
|
start-info.insert("rx", start-info.x + start-info.ll-lvl)
|
||||||
|
end-info.insert("rx", end-info.x + end-info.ll-lvl)
|
||||||
|
|
||||||
|
// Choose correct points to link
|
||||||
|
let x1 = start-info.rx
|
||||||
|
let x2 = end-info.lx
|
||||||
|
|
||||||
|
if (start-info.i > end-info.i) {
|
||||||
|
x1 = start-info.lx
|
||||||
|
x2 = end-info.rx
|
||||||
}
|
}
|
||||||
|
|
||||||
let style = (
|
let style = (
|
||||||
@ -121,9 +125,17 @@
|
|||||||
)
|
)
|
||||||
|
|
||||||
if elmt.p1 == elmt.p2 {
|
if elmt.p1 == elmt.p2 {
|
||||||
let x3 = x1 - ll-lvl1 + ll-lvl2
|
if elmt.flip {
|
||||||
|
x1 = start-info.lx
|
||||||
|
} else {
|
||||||
|
x2 = end-info.rx
|
||||||
|
}
|
||||||
|
|
||||||
x2 = if elmt.flip {x1 - 20} else {x1 + 20}
|
let x-mid = if elmt.flip {
|
||||||
|
calc.min(x1, x2) - 20
|
||||||
|
} else {
|
||||||
|
calc.max(x1, x2) + 20
|
||||||
|
}
|
||||||
|
|
||||||
if elmt.comment != none {
|
if elmt.comment != none {
|
||||||
shapes += draw.content(
|
shapes += draw.content(
|
||||||
@ -136,9 +148,9 @@
|
|||||||
|
|
||||||
shapes += draw.line(
|
shapes += draw.line(
|
||||||
(x1, y),
|
(x1, y),
|
||||||
(x2, y),
|
(x-mid, y),
|
||||||
|
(x-mid, y - 10),
|
||||||
(x2, y - 10),
|
(x2, y - 10),
|
||||||
(x3, y - 10),
|
|
||||||
..style
|
..style
|
||||||
)
|
)
|
||||||
y -= 10
|
y -= 10
|
||||||
|
Loading…
Reference in New Issue
Block a user