mirror of
https://github.com/vsariola/sointu.git
synced 2025-05-27 19:00:25 -04:00
fix(tracker): click on hex track low/high nibble selects that nibble
Closes #160
This commit is contained in:
parent
5099c61705
commit
7470413ad8
@ -24,6 +24,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||
the command line tools.
|
||||
|
||||
### Fixed
|
||||
- Clicking on low nibble or high nibble of a hex track selects that nibble
|
||||
([#160][i160])
|
||||
- If units have useless parameters in their parameter maps, from bugs or from a
|
||||
malformed yaml file, they are removed and user is warned about it
|
||||
- Pressing a or 1 when editing note values in hex mode created a note off line
|
||||
@ -257,5 +259,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||
[i151]: https://github.com/vsariola/sointu/issues/151
|
||||
[i154]: https://github.com/vsariola/sointu/issues/154
|
||||
[i158]: https://github.com/vsariola/sointu/issues/158
|
||||
[i160]: https://github.com/vsariola/sointu/issues/160
|
||||
[i162]: https://github.com/vsariola/sointu/issues/162
|
||||
[i166]: https://github.com/vsariola/sointu/issues/166
|
@ -146,13 +146,11 @@ func (s *ScrollTableStyle) handleEvents(gtx layout.Context, p image.Point) {
|
||||
if e.Kind == pointer.Press {
|
||||
gtx.Execute(key.FocusCmd{Tag: s.ScrollTable})
|
||||
}
|
||||
dx := (int(e.Position.X) + s.ScrollTable.ColTitleList.List.Position.Offset) / gtx.Dp(s.CellWidth)
|
||||
dy := (int(e.Position.Y) + s.ScrollTable.RowTitleList.List.Position.Offset) / gtx.Dp(s.CellHeight)
|
||||
x := dx + s.ScrollTable.ColTitleList.List.Position.First
|
||||
y := dy + s.ScrollTable.RowTitleList.List.Position.First
|
||||
s.ScrollTable.Table.SetCursor(
|
||||
tracker.Point{X: x, Y: y},
|
||||
)
|
||||
dx := (e.Position.X + float32(s.ScrollTable.ColTitleList.List.Position.Offset)) / float32(gtx.Dp(s.CellWidth))
|
||||
dy := (e.Position.Y + float32(s.ScrollTable.RowTitleList.List.Position.Offset)) / float32(gtx.Dp(s.CellHeight))
|
||||
x := dx + float32(s.ScrollTable.ColTitleList.List.Position.First)
|
||||
y := dy + float32(s.ScrollTable.RowTitleList.List.Position.First)
|
||||
s.ScrollTable.Table.SetCursorFloat(x, y)
|
||||
if !e.Modifiers.Contain(key.ModShift) {
|
||||
s.ScrollTable.Table.SetCursor2(s.ScrollTable.Table.Cursor())
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
package tracker
|
||||
|
||||
import (
|
||||
"math"
|
||||
|
||||
"github.com/vsariola/sointu"
|
||||
"gopkg.in/yaml.v3"
|
||||
)
|
||||
@ -15,6 +17,7 @@ type (
|
||||
Cursor2() Point
|
||||
SetCursor(Point)
|
||||
SetCursor2(Point)
|
||||
SetCursorFloat(x, y float32)
|
||||
Width() int
|
||||
Height() int
|
||||
MoveCursor(dx, dy int) (ok bool)
|
||||
@ -178,6 +181,10 @@ func (m *Order) SetCursor2(p Point) {
|
||||
m.updateCursorRows()
|
||||
}
|
||||
|
||||
func (m *Order) SetCursorFloat(x, y float32) {
|
||||
m.SetCursor(Point{int(x), int(y)})
|
||||
}
|
||||
|
||||
func (v *Order) updateCursorRows() {
|
||||
if v.Cursor() == v.Cursor2() {
|
||||
v.d.Cursor.PatternRow = 0
|
||||
@ -422,6 +429,11 @@ func (v *Notes) SetCursor2(p Point) {
|
||||
v.d.Cursor2.SongPos = v.d.Song.Score.Clamp(sointu.SongPos{PatternRow: p.Y})
|
||||
}
|
||||
|
||||
func (m *Notes) SetCursorFloat(x, y float32) {
|
||||
m.SetCursor(Point{int(x), int(y)})
|
||||
m.d.LowNibble = math.Mod(float64(x), 1.0) > 0.5
|
||||
}
|
||||
|
||||
func (v *Notes) Width() int {
|
||||
return len((*Model)(v).d.Song.Score.Tracks)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user