Skip to content

Commit

Permalink
GridLayout: Fix size calculation when spanning over empty section
Browse files Browse the repository at this point in the history
  • Loading branch information
lxn committed Jul 27, 2017
1 parent dbba749 commit 7a6f8cb
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions gridlayout.go
Original file line number Diff line number Diff line change
Expand Up @@ -510,17 +510,21 @@ func (l *GridLayout) Update(reset bool) error {

w := 0
for i := info.cell.column; i < info.cell.column+info.spanHorz; i++ {
w += widths[i]
if i > info.cell.column {
w += l.spacing
if width := widths[i]; width > 0 {
w += width
if i > info.cell.column {
w += l.spacing
}
}
}

h := 0
for i := info.cell.row; i < info.cell.row+info.spanVert; i++ {
h += heights[i]
if i > info.cell.row {
h += l.spacing
if height := heights[i]; height > 0 {
h += height
if i > info.cell.row {
h += l.spacing
}
}
}

Expand Down

0 comments on commit 7a6f8cb

Please sign in to comment.