feat(tracker): layout patterns in the top left

This commit is contained in:
vsariola 2021-01-06 14:24:56 +02:00
parent 34eecd59f5
commit 2b38297da2
2 changed files with 9 additions and 11 deletions

View File

@ -9,13 +9,6 @@ import (
func (t *Tracker) Layout(gtx layout.Context) {
layout.Flex{Axis: layout.Vertical}.Layout(gtx,
layout.Rigid(t.layoutControls),
layout.Rigid(Lowered(t.layoutPatterns(
t.song.Tracks,
t.ActiveTrack,
t.DisplayPattern,
t.CursorColumn,
t.PlayPattern,
))),
layout.Flexed(1, Lowered(t.layoutTracker)),
)
}
@ -45,8 +38,14 @@ func (t *Tracker) layoutTracker(gtx layout.Context) layout.Dimensions {
func (t *Tracker) layoutControls(gtx layout.Context) layout.Dimensions {
gtx.Constraints.Min.Y = 200
gtx.Constraints.Max.Y = 200
return layout.Stack{Alignment: layout.NW}.Layout(gtx,
layout.Expanded(t.QuitButton.Layout),
layout.Stacked(Raised(Label(fmt.Sprintf("Current octave: %v", t.CurrentOctave), white))),
return layout.Flex{Axis: layout.Horizontal}.Layout(gtx,
layout.Rigid(Lowered(t.layoutPatterns(
t.song.Tracks,
t.ActiveTrack,
t.DisplayPattern,
t.CursorColumn,
t.PlayPattern,
))),
layout.Flexed(1, Raised(Label(fmt.Sprintf("Current octave: %v", t.CurrentOctave), white))),
)
}

View File

@ -26,7 +26,6 @@ func (t *Tracker) layoutPatterns(tracks []sointu.Track, activeTrack, cursorPatte
paint.FillShape(gtx.Ops, panelColor, clip.Rect{Max: image.Pt(gtx.Constraints.Max.X, trackRowHeight)}.Op())
for i, track := range tracks {
pop := op.Push(gtx.Ops)
gtx.Constraints.Max.X = patternCellWidth
clip.Rect{Max: gtx.Constraints.Max}.Add(gtx.Ops)
if activeTrack == i {
paint.FillShape(gtx.Ops, activeTrackColor, clip.Rect{