unless the dst is also on a container

This commit is contained in:
Gavin Nishizawa 2023-02-27 14:41:39 -08:00
parent 4d1462473c
commit 454196be9b
No known key found for this signature in database
GPG key ID: AE3B177777CE55CD

View file

@ -367,7 +367,10 @@ func Layout(ctx context.Context, g *d2graph.Graph, opts *ConfigurableOpts) (err
if e.Src == curr { if e.Src == curr {
// Don't move src points on side of container // 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) { 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]) { if shouldMove(e.Route[0]) {
e.Route[0].Y += stepSize e.Route[0].Y += stepSize