mirror of
https://github.com/vsariola/sointu.git
synced 2025-07-14 11:04:23 -04:00
fix(tracker): clamp CurrentUnit to valid values when instrument changes
This commit is contained in:
@ -112,6 +112,9 @@ func (t *Tracker) layoutInstrumentNames(gtx C) D {
|
|||||||
dims := instrumentList.Layout(gtx)
|
dims := instrumentList.Layout(gtx)
|
||||||
if t.CurrentInstrument != t.InstrumentDragList.SelectedItem {
|
if t.CurrentInstrument != t.InstrumentDragList.SelectedItem {
|
||||||
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)
|
op.InvalidateOp{}.Add(gtx.Ops)
|
||||||
}
|
}
|
||||||
return dims
|
return dims
|
||||||
|
Reference in New Issue
Block a user