mirror of
https://github.com/vsariola/sointu.git
synced 2025-07-22 15:04:36 -04:00
refactor(tracker): Make Action have separate Doer and Enabler
This commit is contained in:
parent
d6badb97be
commit
036cb1f34d
@ -332,11 +332,11 @@ func (p ParameterStyle) Layout(gtx C) D {
|
||||
name, _, _, _ := p.tracker.Instruments().Item(i)
|
||||
instrItems[i].Text = name
|
||||
instrItems[i].IconBytes = icons.NavigationChevronRight
|
||||
instrItems[i].Doer = tracker.Allow(func() {
|
||||
instrItems[i].Doer = tracker.MakeEnabledAction((tracker.DoFunc)(func() {
|
||||
if id, ok := p.tracker.Instruments().FirstID(i); ok {
|
||||
tracker.Int{IntData: p.w.Parameter}.Set(id)
|
||||
}
|
||||
})
|
||||
}))
|
||||
}
|
||||
var unitItems []MenuItem
|
||||
instrName := "<instr>"
|
||||
@ -350,9 +350,9 @@ func (p ParameterStyle) Layout(gtx C) D {
|
||||
id := unit.ID
|
||||
unitItems[j].Text = buildUnitLabel(j, unit)
|
||||
unitItems[j].IconBytes = icons.NavigationChevronRight
|
||||
unitItems[j].Doer = tracker.Allow(func() {
|
||||
unitItems[j].Doer = tracker.MakeEnabledAction((tracker.DoFunc)(func() {
|
||||
tracker.Int{IntData: p.w.Parameter}.Set(id)
|
||||
})
|
||||
}))
|
||||
}
|
||||
}
|
||||
defer pointer.PassOp{}.Push(gtx.Ops).Pop()
|
||||
|
Reference in New Issue
Block a user