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
@@ -36,6 +36,7 @@ func (v *VboxCustomPadding) Layout(objects []fyne.CanvasObject, size fyne.Size)
x, y := float32(0), float32(0)
padding := theme.Padding() + v.ExtraPad
extra := float32(0)
for _, child := range objects {
if !child.Visible() {
@@ -45,6 +46,6 @@ func (v *VboxCustomPadding) Layout(objects []fyne.CanvasObject, size fyne.Size)
child.Move(fyne.NewPos(x, y+extra))
y += height
child.Resize(fyne.NewSize(size.Width, height))
extra += (theme.Padding() + v.ExtraPad)
extra += padding
}
}