mirror of
https://github.com/vsariola/sointu.git
synced 2025-06-04 01:28:45 -04:00
fix(tracker): clamp CurrentUnit to valid values when instrument changes
This commit is contained in:
parent
ef59c4a61a
commit
6c0cf6832e
@ -112,6 +112,9 @@ func (t *Tracker) layoutInstrumentNames(gtx C) D {
|
||||
dims := instrumentList.Layout(gtx)
|
||||
if t.CurrentInstrument != t.InstrumentDragList.SelectedItem {
|
||||
t.CurrentInstrument = t.InstrumentDragList.SelectedItem
|
||||
if l := len(t.song.Patch.Instruments[t.CurrentInstrument].Units); t.CurrentUnit >= l {
|
||||
t.CurrentUnit = l - 1
|
||||
}
|
||||
op.InvalidateOp{}.Add(gtx.Ops)
|
||||
}
|
||||
return dims
|
||||
|
Loading…
x
Reference in New Issue
Block a user