mirror of
https://github.com/vsariola/sointu.git
synced 2025-07-18 21:14:31 -04:00
refactor(tracker): use go v1.23 style iterators throughout
This commit is contained in:
parent
2b7ce39069
commit
97e59c5650
@ -102,11 +102,10 @@ func (pe *UnitEditor) layoutSliders(gtx C, t *Tracker) D {
|
||||
}
|
||||
|
||||
index := 0
|
||||
t.Model.Params().Iterate(func(param tracker.Parameter) {
|
||||
for param := range t.Model.Params().Iterate() {
|
||||
pe.Parameters[index].Parameter = param
|
||||
index++
|
||||
})
|
||||
|
||||
}
|
||||
element := func(gtx C, index int) D {
|
||||
if index < 0 || index >= numItems {
|
||||
return D{}
|
||||
@ -177,12 +176,12 @@ func (pe *UnitEditor) layoutFooter(gtx C, t *Tracker) D {
|
||||
|
||||
func (pe *UnitEditor) layoutUnitTypeChooser(gtx C, t *Tracker) D {
|
||||
var names [256]string
|
||||
index := 0
|
||||
t.Model.SearchResults().Iterate(func(item string) (ok bool) {
|
||||
names[index] = item
|
||||
index++
|
||||
return index <= 256
|
||||
})
|
||||
for i, item := range t.Model.SearchResults().Iterate() {
|
||||
if i >= 256 {
|
||||
break
|
||||
}
|
||||
names[i] = item
|
||||
}
|
||||
element := func(gtx C, i int) D {
|
||||
w := LabelStyle{Text: names[i], ShadeColor: black, Color: white, Font: labelDefaultFont, FontSize: unit.Sp(12), Shaper: t.Theme.Shaper}
|
||||
if i == pe.searchList.TrackerList.Selected() {
|
||||
|
Reference in New Issue
Block a user