mirror of
https://github.com/vsariola/sointu.git
synced 2025-06-04 01:28:45 -04:00
fix(tracker): the unit type chooser list expands to the right
Also add helpful title label to explain what the unit type chooser does. Closes #35
This commit is contained in:
parent
5f7eed4194
commit
024245b780
@ -156,7 +156,7 @@ func (t *Tracker) layoutUnitTypeChooser(gtx C) D {
|
|||||||
}
|
}
|
||||||
labelStyle := LabelStyle{Text: allUnits[i], ShadeColor: black, Color: white, Font: labelDefaultFont, FontSize: unit.Sp(12)}
|
labelStyle := LabelStyle{Text: allUnits[i], ShadeColor: black, Color: white, Font: labelDefaultFont, FontSize: unit.Sp(12)}
|
||||||
bg := func(gtx C) D {
|
bg := func(gtx C) D {
|
||||||
gtx.Constraints = layout.Exact(image.Pt(120, 20))
|
gtx.Constraints = layout.Exact(image.Pt(gtx.Constraints.Max.X, 20))
|
||||||
var color color.NRGBA
|
var color color.NRGBA
|
||||||
if t.ChooseUnitTypeBtns[i].Hovered() {
|
if t.ChooseUnitTypeBtns[i].Hovered() {
|
||||||
color = unitTypeListHighlightColor
|
color = unitTypeListHighlightColor
|
||||||
@ -169,5 +169,13 @@ func (t *Tracker) layoutUnitTypeChooser(gtx C) D {
|
|||||||
layout.Expanded(labelStyle.Layout),
|
layout.Expanded(labelStyle.Layout),
|
||||||
layout.Expanded(t.ChooseUnitTypeBtns[i].Layout))
|
layout.Expanded(t.ChooseUnitTypeBtns[i].Layout))
|
||||||
}
|
}
|
||||||
return t.ChooseUnitTypeList.Layout(gtx, len(allUnits), listElem)
|
hintText := Label("Choose unit type:", white)
|
||||||
|
inset := layout.Inset{Left: unit.Dp(6), Top: unit.Dp(6)}
|
||||||
|
return inset.Layout(gtx, func(gtx C) D {
|
||||||
|
return layout.Flex{Axis: layout.Vertical}.Layout(gtx,
|
||||||
|
layout.Rigid(hintText),
|
||||||
|
layout.Flexed(1, func(gtx C) D {
|
||||||
|
return t.ChooseUnitTypeList.Layout(gtx, len(allUnits), listElem)
|
||||||
|
}))
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user