Skip to content

Commit

Permalink
change uninitialized colCache value from -1 to 0
Browse files Browse the repository at this point in the history
  • Loading branch information
dweymouth authored Feb 5, 2024
1 parent f8630ad commit 1a2e0db
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions widget/gridwrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ type GridWrap struct {
//
// Since: 2.4
func NewGridWrap(length func() int, createItem func() fyne.CanvasObject, updateItem func(GridWrapItemID, fyne.CanvasObject)) *GridWrap {
gwList := &GridWrap{Length: length, CreateItem: createItem, UpdateItem: updateItem, colCountCache: -1}
gwList := &GridWrap{Length: length, CreateItem: createItem, UpdateItem: updateItem}
gwList.ExtendBaseWidget(gwList)
return gwList
}
Expand Down Expand Up @@ -149,7 +149,7 @@ func (l *GridWrap) RefreshItem(id GridWrapItemID) {

// Resize is called when this GridWrap should change size. We refresh to ensure invisible items are drawn.
func (l *GridWrap) Resize(s fyne.Size) {
l.colCountCache = -1
l.colCountCache = 0
l.BaseWidget.Resize(s)
l.offsetUpdated(l.scroller.Offset)
l.scroller.Content.(*fyne.Container).Layout.(*gridWrapLayout).updateGrid(true)
Expand Down Expand Up @@ -558,7 +558,7 @@ func (l *gridWrapLayout) setupGridItem(li *gridWrapItem, id GridWrapItemID, focu
}

func (l *GridWrap) getColCount() int {
if l.colCountCache < 0 {
if l.colCountCache < 1 {
padding := theme.Padding()
l.colCountCache = 1
width := l.Size().Width
Expand Down

0 comments on commit 1a2e0db

Please sign in to comment.