fix(tracker/gioui): advance row by step when inputting a note

Closes #144.
This commit is contained in:
5684185+vsariola@users.noreply.github.com 2024-09-07 17:45:32 +03:00
parent 1daaf1829c
commit 4e1fdf57d9
2 changed files with 11 additions and 0 deletions

View File

@ -9,6 +9,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
resized ([#145][i145]) resized ([#145][i145])
### Fixed ### Fixed
- When inputting a note to the note editor, advance the cursor by step
([#144][i144])
- When loading an instrument, make sure the total number of voices does not go - When loading an instrument, make sure the total number of voices does not go
over the maximum number allowed by vm, and make sure a loaded instrument has over the maximum number allowed by vm, and make sure a loaded instrument has
at least 1 voice at least 1 voice
@ -191,5 +193,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
[i130]: https://github.com/vsariola/sointu/issues/130 [i130]: https://github.com/vsariola/sointu/issues/130
[i139]: https://github.com/vsariola/sointu/issues/139 [i139]: https://github.com/vsariola/sointu/issues/139
[i142]: https://github.com/vsariola/sointu/issues/142 [i142]: https://github.com/vsariola/sointu/issues/142
[i144]: https://github.com/vsariola/sointu/issues/144
[i145]: https://github.com/vsariola/sointu/issues/145 [i145]: https://github.com/vsariola/sointu/issues/145
[i146]: https://github.com/vsariola/sointu/issues/146 [i146]: https://github.com/vsariola/sointu/issues/146

View File

@ -341,6 +341,10 @@ func noteAsValue(octave, note int) byte {
func (te *NoteEditor) command(gtx C, t *Tracker, e key.Event) { func (te *NoteEditor) command(gtx C, t *Tracker, e key.Event) {
if e.Name == "A" || e.Name == "1" { if e.Name == "A" || e.Name == "1" {
t.Model.Notes().Table().Fill(0) t.Model.Notes().Table().Fill(0)
if step := t.Model.Step().Value(); step > 0 {
te.scrollTable.Table.MoveCursor(0, step)
te.scrollTable.Table.SetCursor2(te.scrollTable.Table.Cursor())
}
te.scrollTable.EnsureCursorVisible() te.scrollTable.EnsureCursorVisible()
return return
} }
@ -360,6 +364,10 @@ func (te *NoteEditor) command(gtx C, t *Tracker, e key.Event) {
} }
return return
validNote: validNote:
if step := t.Model.Step().Value(); step > 0 {
te.scrollTable.Table.MoveCursor(0, step)
te.scrollTable.Table.SetCursor2(te.scrollTable.Table.Cursor())
}
te.scrollTable.EnsureCursorVisible() te.scrollTable.EnsureCursorVisible()
if _, ok := t.KeyPlaying[e.Name]; !ok { if _, ok := t.KeyPlaying[e.Name]; !ok {
trk := te.scrollTable.Table.Cursor().X trk := te.scrollTable.Table.Cursor().X