Rename span box

This commit is contained in:
Júlio César Batista 2022-11-29 16:16:41 -08:00
parent 68638899bf
commit de58624f06
No known key found for this signature in database
GPG key ID: 10C4B861BF314878
2 changed files with 4 additions and 4 deletions

View file

@ -18,7 +18,7 @@ const SPAN_WIDTH = 20.
const SPAN_EDGE_PAD = 5.
// as the spans start getting nested, their size grows
const SPAN_BOX_DEPTH_GROW_FACTOR = 10.
const SPAN_DEPTH_GROW_FACTOR = 10.
// when a span has a single edge
const MIN_SPAN_HEIGHT = MIN_EDGE_DISTANCE / 2.

View file

@ -207,19 +207,19 @@ func (sd *sequenceDiagram) placeSpans() {
// if it is the same as the child top left, add some padding
minY := math.Min(minEdgeY, minChildY)
if minY == minChildY {
minY -= SPAN_BOX_DEPTH_GROW_FACTOR
minY -= SPAN_DEPTH_GROW_FACTOR
} else {
minY -= SPAN_EDGE_PAD
}
maxY := math.Max(maxEdgeY, maxChildY)
if maxY == maxChildY {
maxY += SPAN_BOX_DEPTH_GROW_FACTOR
maxY += SPAN_DEPTH_GROW_FACTOR
} else {
maxY += SPAN_EDGE_PAD
}
height := math.Max(maxY-minY, MIN_SPAN_HEIGHT)
width := SPAN_WIDTH + (float64(sd.objectLevel[span]-1) * SPAN_BOX_DEPTH_GROW_FACTOR)
width := SPAN_WIDTH + (float64(sd.objectLevel[span]-1) * SPAN_DEPTH_GROW_FACTOR)
x := rankToX[sd.objectRank[span]] - (width / 2.)
span.Box = geo.NewBox(geo.NewPoint(x, minY), width, height)
}