From de58624f06898ecffb0b3613ab416455b57b661e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BAlio=20C=C3=A9sar=20Batista?= Date: Tue, 29 Nov 2022 16:16:41 -0800 Subject: [PATCH] Rename span box --- d2layouts/d2sequence/constants.go | 2 +- d2layouts/d2sequence/layout.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/d2layouts/d2sequence/constants.go b/d2layouts/d2sequence/constants.go index 4c36086b2..7dc2e8798 100644 --- a/d2layouts/d2sequence/constants.go +++ b/d2layouts/d2sequence/constants.go @@ -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. diff --git a/d2layouts/d2sequence/layout.go b/d2layouts/d2sequence/layout.go index dbba8328e..d0d91de7a 100644 --- a/d2layouts/d2sequence/layout.go +++ b/d2layouts/d2sequence/layout.go @@ -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) }