From 986c75493d37e2031e837108c4461e8afac65221 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Wed, 3 Sep 2014 18:26:49 -0400 Subject: Fixed errors preventing current test program from rendering new Grids correctly. --- grid.go | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/grid.go b/grid.go index 965377a..4de9304 100644 --- a/grid.go +++ b/grid.go @@ -218,27 +218,29 @@ func (g *grid) allocate(x int, y int, width int, height int, d *sizing) (allocat // 2) figure out which columns expand // we only mark the first row/column of a spanning cell as expanding to prevent unexpected behavior - nxexpand := 0 - nyexpand := 0 for i := range g.controls { if g.controls[i].xexpand { xexpand[g.controls[i].x] = true - nxexpand++ } if g.controls[i].yexpand { yexpand[g.controls[i].y] = true - nyexpand++ } } - // 3) assign expanded widths/heights + // 3) compute and assign expanded widths/heights + nxexpand := 0 + nyexpand := 0 for x, expand := range xexpand { - if !expand { + if expand { + nxexpand++ + } else { width -= colwidths[x] } } for y, expand := range yexpand { - if !expand { + if expand { + nyexpand++ + } else { height -= rowheights[y] } } -- cgit v1.2.3