example,cmd: bump gio version

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2020-06-17 11:51:26 +02:00
parent 596e321610
commit dd225d5d07
6 changed files with 18 additions and 25 deletions
+5 -15
View File
@@ -13,7 +13,6 @@ import (
"image/png"
"io/ioutil"
"log"
"math"
"os"
"time"
@@ -35,10 +34,6 @@ import (
var screenshot = flag.String("screenshot", "", "save a screenshot to a file and exit")
var disable = flag.Bool("disable", false, "disable all widgets")
type scaledConfig struct {
Scale float32
}
type iconAndTextButton struct {
theme *material.Theme
button *widget.Clickable
@@ -87,8 +82,11 @@ func saveScreenshot(f string) error {
return err
}
gtx := layout.Context{
Ops: new(op.Ops),
Config: &scaledConfig{scale},
Ops: new(op.Ops),
Metric: unit.Metric{
PxPerDp: scale,
PxPerSp: scale,
},
Constraints: layout.Exact(sz),
Queue: new(router.Router),
}
@@ -304,14 +302,6 @@ func kitchen(gtx layout.Context, th *material.Theme) layout.Dimensions {
})
}
func (s *scaledConfig) Px(v unit.Value) int {
scale := s.Scale
if v.U == unit.UnitPx {
scale = 1
}
return int(math.Round(float64(scale * v.V)))
}
const longText = `1. I learned from my grandfather, Verus, to use good manners, and to
put restraint on anger. 2. In the famous memory of my father I had a
pattern of modesty and manliness. 3. Of my mother I learned to be