fixed some spacing issues
This commit is contained in:
parent
9c83f810bb
commit
6e7dc9913f
@ -86,6 +86,21 @@
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Compute minimum width for self sequences
|
||||||
|
for cell in cells.filter(c => c.i1 == c.i2) {
|
||||||
|
let m = measure(cell.cell)
|
||||||
|
let i = cell.i1
|
||||||
|
if cell.elmt.flip {
|
||||||
|
i -= 1
|
||||||
|
}
|
||||||
|
if 0 <= i and i < widths.len() {
|
||||||
|
widths.at(i) = calc.max(
|
||||||
|
widths.at(i),
|
||||||
|
m.width / 1pt + COMMENT-PAD
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Compute remaining widths for longer sequences (spanning multiple columns)
|
// Compute remaining widths for longer sequences (spanning multiple columns)
|
||||||
let multicol-cells = cells.filter(c => c.i2 - c.i1 > 1)
|
let multicol-cells = cells.filter(c => c.i2 - c.i1 > 1)
|
||||||
multicol-cells = multicol-cells.sorted(key: c => {
|
multicol-cells = multicol-cells.sorted(key: c => {
|
||||||
@ -136,7 +151,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let y = -Y-SPACE
|
let y = 0
|
||||||
let groups = ()
|
let groups = ()
|
||||||
let lifelines = participants.map(_ => (
|
let lifelines = participants.map(_ => (
|
||||||
level: 0,
|
level: 0,
|
||||||
@ -153,6 +168,7 @@
|
|||||||
|
|
||||||
// Groups (start) -> reserve space for labels + store position
|
// Groups (start) -> reserve space for labels + store position
|
||||||
} else if elmt.type == "grp" {
|
} else if elmt.type == "grp" {
|
||||||
|
y -= Y-SPACE
|
||||||
let m = measure(
|
let m = measure(
|
||||||
box(
|
box(
|
||||||
elmt.name,
|
elmt.name,
|
||||||
@ -165,17 +181,16 @@
|
|||||||
g
|
g
|
||||||
})
|
})
|
||||||
groups.push((y, elmt, 0, 0))
|
groups.push((y, elmt, 0, 0))
|
||||||
y -= m.height / 1pt + Y-SPACE
|
y -= m.height / 1pt
|
||||||
|
|
||||||
// Groups (end) -> actual drawing
|
// Groups (end) -> actual drawing
|
||||||
} else if elmt.type == "grp-end" {
|
} else if elmt.type == "grp-end" {
|
||||||
|
y -= Y-SPACE
|
||||||
let (start-y, group, start-lvl, end-lvl) = groups.pop()
|
let (start-y, group, start-lvl, end-lvl) = groups.pop()
|
||||||
let x0 = x-pos.at(group.min-i) - start-lvl * 10 - 20
|
let x0 = x-pos.at(group.min-i) - start-lvl * 10 - 20
|
||||||
let x1 = x-pos.at(group.max-i) + end-lvl * 10 + 20
|
let x1 = x-pos.at(group.max-i) + end-lvl * 10 + 20
|
||||||
shapes += draw-group(x0, x1, start-y, y, group)
|
shapes += draw-group(x0, x1, start-y, y, group)
|
||||||
|
|
||||||
y -= Y-SPACE
|
|
||||||
|
|
||||||
// Separator
|
// Separator
|
||||||
} else if elmt.type == "sep" {
|
} else if elmt.type == "sep" {
|
||||||
let shps
|
let shps
|
||||||
@ -211,6 +226,8 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
y -= Y-SPACE
|
||||||
|
|
||||||
// Draw vertical lines + lifelines + end participants
|
// Draw vertical lines + lifelines + end participants
|
||||||
shapes += draw.on-layer(-1, {
|
shapes += draw.on-layer(-1, {
|
||||||
if DEBUG-INVISIBLE {
|
if DEBUG-INVISIBLE {
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
#let render(x-pos, elmt, y) = {
|
#let render(x-pos, elmt, y) = {
|
||||||
let shapes = ()
|
let shapes = ()
|
||||||
|
y -= Y-SPACE
|
||||||
|
|
||||||
let x0 = x-pos.first() - 20
|
let x0 = x-pos.first() - 20
|
||||||
let x1 = x-pos.last() + 20
|
let x1 = x-pos.last() + 20
|
||||||
@ -48,7 +49,6 @@
|
|||||||
fill: COL-SEP-NAME
|
fill: COL-SEP-NAME
|
||||||
)
|
)
|
||||||
y -= h / 2
|
y -= h / 2
|
||||||
y -= Y-SPACE
|
|
||||||
|
|
||||||
let r = (y, shapes)
|
let r = (y, shapes)
|
||||||
return r
|
return r
|
||||||
|
@ -40,6 +40,8 @@
|
|||||||
#let render(pars-i, x-pos, participants, elmt, y, lifelines) = {
|
#let render(pars-i, x-pos, participants, elmt, y, lifelines) = {
|
||||||
let shapes = ()
|
let shapes = ()
|
||||||
|
|
||||||
|
y -= Y-SPACE
|
||||||
|
|
||||||
// Reserve space for comment
|
// Reserve space for comment
|
||||||
if elmt.comment != none {
|
if elmt.comment != none {
|
||||||
y -= measure(box(elmt.comment)).height / 1pt + 6
|
y -= measure(box(elmt.comment)).height / 1pt + 6
|
||||||
@ -185,7 +187,6 @@
|
|||||||
dst-line.lines.push(("create", y))
|
dst-line.lines.push(("create", y))
|
||||||
lifelines.at(i2) = dst-line
|
lifelines.at(i2) = dst-line
|
||||||
}
|
}
|
||||||
y -= Y-SPACE
|
|
||||||
|
|
||||||
let r = (y, lifelines, shapes)
|
let r = (y, lifelines, shapes)
|
||||||
return r
|
return r
|
||||||
|
Loading…
Reference in New Issue
Block a user