This commit is contained in:
Alexander Wang 2023-02-10 12:20:00 -08:00
parent 939a5ca088
commit ac960ae488
No known key found for this signature in database
GPG key ID: D89FA31966BDBECE

View file

@ -7,7 +7,6 @@ import (
"fmt"
"math"
"regexp"
"sort"
"strings"
"cdr.dev/slog"
@ -341,14 +340,7 @@ func Layout(ctx context.Context, g *d2graph.Graph, opts *ConfigurableOpts) (err
}
}
// TODO probably don't need
byLevels := make([]*d2graph.Object, len(g.Objects))
copy(byLevels, g.Objects)
sort.SliceStable(byLevels, func(i, j int) bool {
return byLevels[i].Level() > byLevels[j].Level()
})
for _, obj := range byLevels {
for _, obj := range g.Objects {
if obj.LabelHeight == nil || len(obj.ChildrenArray) <= 0 {
continue
}