From c9d50033430ccefbd168fd96b7a6da5c53e6383a Mon Sep 17 00:00:00 2001 From: Gavin Nishizawa Date: Wed, 27 Sep 2023 15:31:45 -0700 Subject: [PATCH] fix --- d2layouts/d2layouts.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/d2layouts/d2layouts.go b/d2layouts/d2layouts.go index 866944389..58851c8aa 100644 --- a/d2layouts/d2layouts.go +++ b/d2layouts/d2layouts.go @@ -122,10 +122,13 @@ func LayoutNested(ctx context.Context, g *d2graph.Graph, graphInfo GraphInfo, co } curr = obj - // position nested graph relative to curr + // position nested graph (excluding curr) relative to curr dx := 0 - curr.TopLeft.X dy := 0 - curr.TopLeft.Y for _, o := range nestedGraph.Objects { + if o.AbsID() == curr.AbsID() { + continue + } o.TopLeft.X += dx o.TopLeft.Y += dy }