mirror of
https://github.com/vsariola/sointu.git
synced 2025-07-18 21:14:31 -04:00
refactor(tracker/gioui): update gioui to newer version
This commit is contained in:
parent
f5980ecb79
commit
8c4f7ee61f
@ -4,7 +4,7 @@ import (
|
||||
"image"
|
||||
"image/color"
|
||||
|
||||
"gioui.org/f32"
|
||||
"gioui.org/font"
|
||||
"gioui.org/layout"
|
||||
"gioui.org/op"
|
||||
"gioui.org/op/paint"
|
||||
@ -18,20 +18,20 @@ type LabelStyle struct {
|
||||
Color color.NRGBA
|
||||
ShadeColor color.NRGBA
|
||||
Alignment layout.Direction
|
||||
Font text.Font
|
||||
FontSize unit.Value
|
||||
Font font.Font
|
||||
FontSize unit.Sp
|
||||
}
|
||||
|
||||
func (l LabelStyle) Layout(gtx layout.Context) layout.Dimensions {
|
||||
return layout.Stack{Alignment: l.Alignment}.Layout(gtx,
|
||||
layout.Stacked(func(gtx layout.Context) layout.Dimensions {
|
||||
defer op.Save(gtx.Ops).Load()
|
||||
defer op.Offset(image.Point{}).Push(gtx.Ops).Pop()
|
||||
paint.ColorOp{Color: l.ShadeColor}.Add(gtx.Ops)
|
||||
op.Offset(f32.Pt(2, 2)).Add(gtx.Ops)
|
||||
op.Offset(image.Pt(2, 2)).Add(gtx.Ops)
|
||||
dims := widget.Label{
|
||||
Alignment: text.Start,
|
||||
MaxLines: 1,
|
||||
}.Layout(gtx, textShaper, l.Font, l.FontSize, l.Text)
|
||||
}.Layout(gtx, textShaper, l.Font, l.FontSize, l.Text, op.CallOp{})
|
||||
return layout.Dimensions{
|
||||
Size: dims.Size.Add(image.Pt(2, 2)),
|
||||
Baseline: dims.Baseline,
|
||||
@ -42,7 +42,7 @@ func (l LabelStyle) Layout(gtx layout.Context) layout.Dimensions {
|
||||
return widget.Label{
|
||||
Alignment: text.Start,
|
||||
MaxLines: 1,
|
||||
}.Layout(gtx, textShaper, l.Font, l.FontSize, l.Text)
|
||||
}.Layout(gtx, textShaper, l.Font, l.FontSize, l.Text, op.CallOp{})
|
||||
}),
|
||||
)
|
||||
}
|
||||
|
Reference in New Issue
Block a user