fix: cr, return value

This commit is contained in:
donglixiaoche 2023-03-28 08:57:15 +08:00
parent 66f620f57b
commit 3d45f6ab51
No known key found for this signature in database
GPG key ID: 3190E65EBAD6D6E2
2 changed files with 4 additions and 5 deletions

View file

@ -968,16 +968,15 @@ func (obj *Object) GetDefaultSize(mtexts []*d2target.MText, ruler *textmeasure.R
return &dims, nil
}
func (obj *Object) IsInsideNearContainer() bool {
func (obj *Object) OuterNearContainer() *Object {
temp := obj
for temp != nil {
fmt.Println(temp.ID)
if temp.Attributes.NearKey != nil {
return true
return temp
}
temp = temp.Parent
}
return false
return nil
}
type Edge struct {

View file

@ -225,7 +225,7 @@ func boundingBox(g *d2graph.Graph) (tl, br *geo.Point) {
y2 = math.Max(y2, obj.TopLeft.Y+obj.Height)
}
} else {
if obj.IsInsideNearContainer() {
if obj.OuterNearContainer() != nil {
continue
}
x1 = math.Min(x1, obj.TopLeft.X)