Skip to content

Commit

Permalink
adding a single comment missed in last commit
Browse files Browse the repository at this point in the history
  • Loading branch information
m1gwings committed Sep 1, 2020
1 parent c4fe2db commit b40c547
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tree/stringify.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,11 @@ func stringify(t *Tree) *drawer.Drawer {
log.Fatal(fmt.Errorf("childrenMiddle is not sorted"))
}

// w is the width of the final drawer and is equal to the maximum between dValW+2 and childrenW
var w int
if dValW+2 > childrenW {
w = dValW + 2
// If parent width is greater than children width, children get centered by shifing each child
for i := 0; i < nChildren; i++ {
childrenLeft[i] += (w - childrenW) / 2
childrenMiddle[i] += (w - childrenW) / 2
Expand Down

0 comments on commit b40c547

Please sign in to comment.