don't re-calculate values in loops for layouts

This commit is contained in:
Drew Weymouth
2023-05-03 09:09:13 -07:00
parent fd01e37260
commit e486fcddad
5 changed files with 16 additions and 10 deletions
+2 -1
View File
@@ -37,6 +37,7 @@ func (v *HboxCustomPadding) Layout(objects []fyne.CanvasObject, size fyne.Size)
x, y := float32(0), float32(0)
padding := v.themePad() + v.ExtraPad
extra := float32(0)
for _, child := range objects {
if !child.Visible() {
@@ -46,7 +47,7 @@ func (v *HboxCustomPadding) Layout(objects []fyne.CanvasObject, size fyne.Size)
child.Move(fyne.NewPos(x+extra, y))
x += width
child.Resize(fyne.NewSize(width, size.Height))
extra += (v.themePad() + v.ExtraPad)
extra += padding
}
}