account for child 3d/multiple in bounding box

This commit is contained in:
Gavin Nishizawa 2023-07-14 12:01:54 -07:00
parent 8cce0aa54c
commit 5d7b0af127
No known key found for this signature in database
GPG key ID: AE3B177777CE55CD

View file

@ -1340,11 +1340,12 @@ func fitPadding(obj *d2graph.Object) {
for _, child := range obj.ChildrenArray {
margin, _ := getSpacing(child)
dx, dy := child.GetModifierElementAdjustments()
innerTop = math.Min(innerTop, child.TopLeft.Y-math.Max(margin.top, padding.top))
innerTop = math.Min(innerTop, child.TopLeft.Y-dy-math.Max(margin.top, padding.top))
innerBottom = math.Max(innerBottom, child.TopLeft.Y+child.Height+math.Max(margin.bottom, padding.bottom))
innerLeft = math.Min(innerLeft, child.TopLeft.X-math.Max(margin.left, padding.left))
innerRight = math.Max(innerRight, child.TopLeft.X+child.Width+math.Max(margin.right, padding.right))
innerRight = math.Max(innerRight, child.TopLeft.X+child.Width+dx+math.Max(margin.right, padding.right))
}
currentTop := obj.TopLeft.Y