Skip to content

Commit

Permalink
Clean up MinSize math for padding
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacalz committed May 1, 2024
1 parent b4a0d1d commit 670a45e
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions layout/formlayout.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,21 +116,18 @@ func (f *formLayout) Layout(objects []fyne.CanvasObject, size fyne.Size) {
// the sum of all column children combined with padding between each.
func (f *formLayout) MinSize(objects []fyne.CanvasObject) fyne.Size {
labelWidth, contentWidth, heights := f.tableCellsSize(objects, 0)

minSize := fyne.NewSize(0, 0)
if len(heights) == 0 {
return minSize
return fyne.Size{}
}

padding := theme.Padding()
added := false
minSize.Width = labelWidth + contentWidth + padding
minSize := fyne.Size{
Width: labelWidth + contentWidth + padding,
Height: padding * float32(len(heights)-1),
}

for row := 0; row < len(heights); row++ {
minSize.Height += heights[row]
if added {
minSize.Height += padding
}
added = true
}
return minSize
}
Expand Down

0 comments on commit 670a45e

Please sign in to comment.