update to latest gioui.org API, fix cross platform builds
This commit is contained in:
46
intslider.go
46
intslider.go
@@ -3,7 +3,7 @@ package gel
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
l "github.com/p9c/p9/pkg/gel/gio/layout"
|
||||
l "gioui.org/layout"
|
||||
)
|
||||
|
||||
type IntSlider struct {
|
||||
@@ -53,34 +53,46 @@ func (i *IntSlider) GetValue() int {
|
||||
func (i *IntSlider) Fn(gtx l.Context) l.Dimensions {
|
||||
return i.Flex().Rigid(
|
||||
i.Button(
|
||||
i.min.SetClick(func() {
|
||||
i.floater.SetValue(i.minV)
|
||||
i.hook(int(i.minV))
|
||||
})).
|
||||
i.min.SetClick(
|
||||
func() {
|
||||
i.floater.SetValue(i.minV)
|
||||
i.hook(int(i.minV))
|
||||
},
|
||||
),
|
||||
).
|
||||
Inset(0.25).
|
||||
Color("Primary").
|
||||
Background("Transparent").
|
||||
Font("bariol regular").
|
||||
Text("0").
|
||||
Fn,
|
||||
).Flexed(1,
|
||||
i.Inset(0.25,
|
||||
).Flexed(
|
||||
1,
|
||||
i.Inset(
|
||||
0.25,
|
||||
i.Slider().
|
||||
Float(i.floater.SetHook(func(fl float32) {
|
||||
iFl := int(fl + 0.5)
|
||||
i.value = iFl
|
||||
i.floater.SetValue(float32(iFl))
|
||||
i.hook(iFl)
|
||||
})).
|
||||
Float(
|
||||
i.floater.SetHook(
|
||||
func(fl float32) {
|
||||
iFl := int(fl + 0.5)
|
||||
i.value = iFl
|
||||
i.floater.SetValue(float32(iFl))
|
||||
i.hook(iFl)
|
||||
},
|
||||
),
|
||||
).
|
||||
Min(i.minV).Max(i.maxV).
|
||||
Fn,
|
||||
).Fn,
|
||||
).Rigid(
|
||||
i.Button(
|
||||
i.max.SetClick(func() {
|
||||
i.floater.SetValue(i.maxV)
|
||||
i.hook(int(i.maxV))
|
||||
})).
|
||||
i.max.SetClick(
|
||||
func() {
|
||||
i.floater.SetValue(i.maxV)
|
||||
i.hook(int(i.maxV))
|
||||
},
|
||||
),
|
||||
).
|
||||
Inset(0.25).
|
||||
Color("Primary").
|
||||
Background("Transparent").
|
||||
|
||||
Reference in New Issue
Block a user