Rename to maxObjectZIndex

This commit is contained in:
Júlio César Batista 2022-11-29 21:36:19 -08:00
parent 0fc1294ae6
commit a5943d505b
No known key found for this signature in database
GPG key ID: 10C4B861BF314878

View file

@ -17,13 +17,13 @@ func Export(ctx context.Context, g *d2graph.Graph, themeID int64) (*d2target.Dia
diagram := d2target.NewDiagram() diagram := d2target.NewDiagram()
diagram.Shapes = make([]d2target.Shape, len(g.Objects)) diagram.Shapes = make([]d2target.Shape, len(g.Objects))
highestObjectPriority := 0 maxObjectZIndex := 0
for i := range g.Objects { for i := range g.Objects {
diagram.Shapes[i] = toShape(g.Objects[i], &theme) diagram.Shapes[i] = toShape(g.Objects[i], &theme)
highestObjectPriority = go2.IntMax(highestObjectPriority, diagram.Shapes[i].ZIndex) maxObjectZIndex = go2.IntMax(maxObjectZIndex, diagram.Shapes[i].ZIndex)
} }
edgeDefaultZIndex := highestObjectPriority + 1 edgeDefaultZIndex := maxObjectZIndex + 1
diagram.Connections = make([]d2target.Connection, len(g.Edges)) diagram.Connections = make([]d2target.Connection, len(g.Edges))
for i := range g.Edges { for i := range g.Edges {
diagram.Connections[i] = toConnection(g.Edges[i], &theme, edgeDefaultZIndex) diagram.Connections[i] = toConnection(g.Edges[i], &theme, edgeDefaultZIndex)