mirror of
https://github.com/vsariola/sointu.git
synced 2025-07-18 13:04:25 -04:00
feat(tracker): layout patterns in the top left
This commit is contained in:
@ -9,13 +9,6 @@ import (
|
|||||||
func (t *Tracker) Layout(gtx layout.Context) {
|
func (t *Tracker) Layout(gtx layout.Context) {
|
||||||
layout.Flex{Axis: layout.Vertical}.Layout(gtx,
|
layout.Flex{Axis: layout.Vertical}.Layout(gtx,
|
||||||
layout.Rigid(t.layoutControls),
|
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)),
|
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 {
|
func (t *Tracker) layoutControls(gtx layout.Context) layout.Dimensions {
|
||||||
gtx.Constraints.Min.Y = 200
|
gtx.Constraints.Min.Y = 200
|
||||||
gtx.Constraints.Max.Y = 200
|
gtx.Constraints.Max.Y = 200
|
||||||
return layout.Stack{Alignment: layout.NW}.Layout(gtx,
|
return layout.Flex{Axis: layout.Horizontal}.Layout(gtx,
|
||||||
layout.Expanded(t.QuitButton.Layout),
|
layout.Rigid(Lowered(t.layoutPatterns(
|
||||||
layout.Stacked(Raised(Label(fmt.Sprintf("Current octave: %v", t.CurrentOctave), white))),
|
t.song.Tracks,
|
||||||
|
t.ActiveTrack,
|
||||||
|
t.DisplayPattern,
|
||||||
|
t.CursorColumn,
|
||||||
|
t.PlayPattern,
|
||||||
|
))),
|
||||||
|
layout.Flexed(1, Raised(Label(fmt.Sprintf("Current octave: %v", t.CurrentOctave), white))),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -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())
|
paint.FillShape(gtx.Ops, panelColor, clip.Rect{Max: image.Pt(gtx.Constraints.Max.X, trackRowHeight)}.Op())
|
||||||
for i, track := range tracks {
|
for i, track := range tracks {
|
||||||
pop := op.Push(gtx.Ops)
|
pop := op.Push(gtx.Ops)
|
||||||
gtx.Constraints.Max.X = patternCellWidth
|
|
||||||
clip.Rect{Max: gtx.Constraints.Max}.Add(gtx.Ops)
|
clip.Rect{Max: gtx.Constraints.Max}.Add(gtx.Ops)
|
||||||
if activeTrack == i {
|
if activeTrack == i {
|
||||||
paint.FillShape(gtx.Ops, activeTrackColor, clip.Rect{
|
paint.FillShape(gtx.Ops, activeTrackColor, clip.Rect{
|
||||||
|
Reference in New Issue
Block a user