From 454196be9b7c2fc7d7a958e94c3b42be8f110eb5 Mon Sep 17 00:00:00 2001 From: Gavin Nishizawa Date: Mon, 27 Feb 2023 14:41:39 -0800 Subject: [PATCH] unless the dst is also on a container --- d2layouts/d2dagrelayout/layout.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/d2layouts/d2dagrelayout/layout.go b/d2layouts/d2dagrelayout/layout.go index ac34f58ac..20bb0ab46 100644 --- a/d2layouts/d2dagrelayout/layout.go +++ b/d2layouts/d2dagrelayout/layout.go @@ -367,7 +367,10 @@ func Layout(ctx context.Context, g *d2graph.Graph, opts *ConfigurableOpts) (err if e.Src == curr { // Don't move src points on side of container if almostEqual(e.Route[0].X, obj.TopLeft.X) || almostEqual(e.Route[0].X, obj.TopLeft.X+obj.Width) { - continue + // Unless the dst is also on a container + if e.Dst.LabelHeight == nil || len(e.Dst.ChildrenArray) <= 0 { + continue + } } if shouldMove(e.Route[0]) { e.Route[0].Y += stepSize