feat(tracker/gioui): show scroll bar in the instrument properties

This commit is contained in:
5684185+vsariola@users.noreply.github.com
2026-02-14 20:57:19 +02:00
parent cd4b85a66b
commit f2f76c0e18

View File

@ -35,6 +35,8 @@ type (
noteEnd *NumericUpDownState noteEnd *NumericUpDownState
transpose *NumericUpDownState transpose *NumericUpDownState
midiChannel *NumericUpDownState midiChannel *NumericUpDownState
scrollBar ScrollBar
} }
) )
@ -55,6 +57,7 @@ func NewInstrumentProperties() *InstrumentProperties {
noteEnd: NewNumericUpDownState(), noteEnd: NewNumericUpDownState(),
transpose: NewNumericUpDownState(), transpose: NewNumericUpDownState(),
midiChannel: NewNumericUpDownState(), midiChannel: NewNumericUpDownState(),
scrollBar: ScrollBar{Axis: layout.Vertical},
} }
ret.soloHint = makeHint("Solo", " (%s)", "SoloToggle") ret.soloHint = makeHint("Solo", " (%s)", "SoloToggle")
ret.unsoloHint = makeHint("Unsolo", " (%s)", "SoloToggle") ret.unsoloHint = makeHint("Unsolo", " (%s)", "SoloToggle")
@ -96,9 +99,9 @@ func (ip *InstrumentProperties) layout(gtx C) D {
layout.Rigid(thread4btn.Layout), layout.Rigid(thread4btn.Layout),
) )
} }
gtx.Constraints.Max.X = min(gtx.Dp(300), gtx.Constraints.Max.X) ret := ip.list.Layout(gtx, 18, func(gtx C, index int) D {
gtx.Constraints.Min.X = min(gtx.Constraints.Max.X, gtx.Constraints.Min.X) gtx.Constraints.Max.X = min(gtx.Dp(300), gtx.Constraints.Max.X)
return ip.list.Layout(gtx, 18, func(gtx C, index int) D { gtx.Constraints.Min.X = min(gtx.Constraints.Max.X, gtx.Constraints.Min.X)
switch index { switch index {
case 0: case 0:
return layoutInstrumentPropertyLine(gtx, "Name", func(gtx C) D { return layoutInstrumentPropertyLine(gtx, "Name", func(gtx C) D {
@ -154,6 +157,8 @@ func (ip *InstrumentProperties) layout(gtx C) D {
return D{Size: image.Pt(gtx.Constraints.Max.X, px)} return D{Size: image.Pt(gtx.Constraints.Max.X, px)}
} }
}) })
ip.scrollBar.Layout(gtx, &tr.Theme.ScrollBar, 18, &ip.list.Position)
return ret
} }
func layoutInstrumentPropertyLine(gtx C, text string, content layout.Widget) D { func layoutInstrumentPropertyLine(gtx C, text string, content layout.Widget) D {