mirror of
https://github.com/vsariola/sointu.git
synced 2026-02-18 22:23:13 -05:00
feat(tracker): make clear unit action clear all selected units
This commit is contained in:
parent
4a46d601f2
commit
a37990a7fa
@ -290,9 +290,12 @@ func (m *ClearUnit) Enabled() bool {
|
|||||||
}
|
}
|
||||||
func (m *ClearUnit) Do() {
|
func (m *ClearUnit) Do() {
|
||||||
defer (*Model)(m).change("DeleteUnitAction", PatchChange, MajorChange)()
|
defer (*Model)(m).change("DeleteUnitAction", PatchChange, MajorChange)()
|
||||||
m.d.UnitIndex = max(min(m.d.UnitIndex, len(m.d.Song.Patch[m.d.InstrIndex].Units)-1), 0)
|
l := ((*Model)(m)).Units().List()
|
||||||
m.d.Song.Patch[m.d.InstrIndex].Units[m.d.UnitIndex] = sointu.Unit{}
|
r := l.listRange()
|
||||||
m.d.Song.Patch[m.d.InstrIndex].Units[m.d.UnitIndex].ID = (*Model)(m).maxID() + 1
|
for i := r.Start; i < r.End; i++ {
|
||||||
|
m.d.Song.Patch[m.d.InstrIndex].Units[i] = sointu.Unit{}
|
||||||
|
m.d.Song.Patch[m.d.InstrIndex].Units[i].ID = (*Model)(m).maxID() + 1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Undo
|
// Undo
|
||||||
|
|||||||
Reference in New Issue
Block a user