From 4e1fdf57d97beb7fb307fbffad55312e616116c8 Mon Sep 17 00:00:00 2001 From: "5684185+vsariola@users.noreply.github.com" <5684185+vsariola@users.noreply.github.com> Date: Sat, 7 Sep 2024 17:45:32 +0300 Subject: [PATCH] fix(tracker/gioui): advance row by step when inputting a note Closes #144. --- CHANGELOG.md | 3 +++ tracker/gioui/note_editor.go | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 45dc174..37aa205 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). resized ([#145][i145]) ### 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 over the maximum number allowed by vm, and make sure a loaded instrument has 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 [i139]: https://github.com/vsariola/sointu/issues/139 [i142]: https://github.com/vsariola/sointu/issues/142 +[i144]: https://github.com/vsariola/sointu/issues/144 [i145]: https://github.com/vsariola/sointu/issues/145 [i146]: https://github.com/vsariola/sointu/issues/146 diff --git a/tracker/gioui/note_editor.go b/tracker/gioui/note_editor.go index f4b6956..9274664 100644 --- a/tracker/gioui/note_editor.go +++ b/tracker/gioui/note_editor.go @@ -341,6 +341,10 @@ func noteAsValue(octave, note int) byte { func (te *NoteEditor) command(gtx C, t *Tracker, e key.Event) { if e.Name == "A" || e.Name == "1" { 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() return } @@ -360,6 +364,10 @@ func (te *NoteEditor) command(gtx C, t *Tracker, e key.Event) { } return 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() if _, ok := t.KeyPlaying[e.Name]; !ok { trk := te.scrollTable.Table.Cursor().X