Rename span box
This commit is contained in:
parent
68638899bf
commit
de58624f06
2 changed files with 4 additions and 4 deletions
|
|
@ -18,7 +18,7 @@ const SPAN_WIDTH = 20.
|
||||||
const SPAN_EDGE_PAD = 5.
|
const SPAN_EDGE_PAD = 5.
|
||||||
|
|
||||||
// as the spans start getting nested, their size grows
|
// 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
|
// when a span has a single edge
|
||||||
const MIN_SPAN_HEIGHT = MIN_EDGE_DISTANCE / 2.
|
const MIN_SPAN_HEIGHT = MIN_EDGE_DISTANCE / 2.
|
||||||
|
|
|
||||||
|
|
@ -207,19 +207,19 @@ func (sd *sequenceDiagram) placeSpans() {
|
||||||
// if it is the same as the child top left, add some padding
|
// if it is the same as the child top left, add some padding
|
||||||
minY := math.Min(minEdgeY, minChildY)
|
minY := math.Min(minEdgeY, minChildY)
|
||||||
if minY == minChildY {
|
if minY == minChildY {
|
||||||
minY -= SPAN_BOX_DEPTH_GROW_FACTOR
|
minY -= SPAN_DEPTH_GROW_FACTOR
|
||||||
} else {
|
} else {
|
||||||
minY -= SPAN_EDGE_PAD
|
minY -= SPAN_EDGE_PAD
|
||||||
}
|
}
|
||||||
maxY := math.Max(maxEdgeY, maxChildY)
|
maxY := math.Max(maxEdgeY, maxChildY)
|
||||||
if maxY == maxChildY {
|
if maxY == maxChildY {
|
||||||
maxY += SPAN_BOX_DEPTH_GROW_FACTOR
|
maxY += SPAN_DEPTH_GROW_FACTOR
|
||||||
} else {
|
} else {
|
||||||
maxY += SPAN_EDGE_PAD
|
maxY += SPAN_EDGE_PAD
|
||||||
}
|
}
|
||||||
|
|
||||||
height := math.Max(maxY-minY, MIN_SPAN_HEIGHT)
|
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.)
|
x := rankToX[sd.objectRank[span]] - (width / 2.)
|
||||||
span.Box = geo.NewBox(geo.NewPoint(x, minY), width, height)
|
span.Box = geo.NewBox(geo.NewPoint(x, minY), width, height)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue