cleanup
This commit is contained in:
parent
15a22000a7
commit
5ddfdd42a1
1 changed files with 6 additions and 2 deletions
|
|
@ -122,8 +122,9 @@ func LayoutNested(ctx context.Context, g *d2graph.Graph, graphInfo GraphInfo, co
|
||||||
}
|
}
|
||||||
curr = obj
|
curr = obj
|
||||||
|
|
||||||
dx := -curr.TopLeft.X
|
// position nested graph relative to curr
|
||||||
dy := -curr.TopLeft.Y
|
dx := 0 - curr.TopLeft.X
|
||||||
|
dy := 0 - curr.TopLeft.Y
|
||||||
for _, o := range nestedGraph.Objects {
|
for _, o := range nestedGraph.Objects {
|
||||||
o.TopLeft.X += dx
|
o.TopLeft.X += dx
|
||||||
o.TopLeft.Y += dy
|
o.TopLeft.Y += dy
|
||||||
|
|
@ -358,6 +359,9 @@ func PositionNested(container *d2graph.Object, nestedGraph *d2graph.Graph) {
|
||||||
// Note: assumes nestedGraph's layout has contents positioned relative to 0,0
|
// Note: assumes nestedGraph's layout has contents positioned relative to 0,0
|
||||||
dx := container.TopLeft.X //- tl.X
|
dx := container.TopLeft.X //- tl.X
|
||||||
dy := container.TopLeft.Y //- tl.Y
|
dy := container.TopLeft.Y //- tl.Y
|
||||||
|
if dx == 0 && dy == 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
for _, o := range nestedGraph.Objects {
|
for _, o := range nestedGraph.Objects {
|
||||||
o.TopLeft.X += dx
|
o.TopLeft.X += dx
|
||||||
o.TopLeft.Y += dy
|
o.TopLeft.Y += dy
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue