This commit is contained in:
Gavin Nishizawa 2023-09-27 15:31:45 -07:00
parent 3b53bc5ff1
commit c9d5003343
No known key found for this signature in database
GPG key ID: AE3B177777CE55CD

View file

@ -122,10 +122,13 @@ func LayoutNested(ctx context.Context, g *d2graph.Graph, graphInfo GraphInfo, co
} }
curr = obj curr = obj
// position nested graph relative to curr // position nested graph (excluding curr) relative to curr
dx := 0 - curr.TopLeft.X dx := 0 - curr.TopLeft.X
dy := 0 - curr.TopLeft.Y dy := 0 - curr.TopLeft.Y
for _, o := range nestedGraph.Objects { for _, o := range nestedGraph.Objects {
if o.AbsID() == curr.AbsID() {
continue
}
o.TopLeft.X += dx o.TopLeft.X += dx
o.TopLeft.Y += dy o.TopLeft.Y += dy
} }