apps/gophers: use the new Image.Scale for icons

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2019-07-09 16:02:19 +02:00
parent b1af8aa75e
commit 41626f5a6b
2 changed files with 5 additions and 3 deletions
+1 -1
View File
@@ -3,7 +3,7 @@ module gioui.org/apps
go 1.12
require (
gioui.org/ui v0.0.0-20190709092841-99be31bc2676
gioui.org/ui v0.0.0-20190709140002-b1af8aa75e5e
github.com/google/go-github/v24 v24.0.1
golang.org/x/exp v0.0.0-20190627132806-fd42eb6b336f
golang.org/x/image v0.0.0-20190703141733-d6a02ce849c9
+4 -2
View File
@@ -451,7 +451,8 @@ func (up *userPage) commit(ops *ui.Ops, cs layout.Constraints, index int) layout
sz := ui.Dp(48)
cc := clipCircle{}
cs = cc.Begin(ops, cs)
dims := widget.Image{Src: u.avatar, Rect: u.avatar.Bounds()}.Layout(ops, layout.Sized{Width: sz, Height: sz}.Constrain(c, cs))
cs = layout.Sized{Width: sz, Height: sz}.Constrain(c, cs)
dims := widget.Image{Src: u.avatar, Rect: u.avatar.Bounds(), Scale: 1}.Layout(c, ops, cs)
dims = cc.End(dims)
c1 := f.End(dims)
cs = f.Flexible(1, layout.Fit)
@@ -597,7 +598,8 @@ func (a *App) user(ops *ui.Ops, cs layout.Constraints, c *ui.Config, index int)
in := layout.Insets{Right: ui.Dp(8)}
cc := clipCircle{}
cs = cc.Begin(ops, in.Begin(c, ops, cs))
dims = widget.Image{Src: u.avatar, Rect: u.avatar.Bounds()}.Layout(ops, layout.Sized{Width: ui.Dp(48), Height: ui.Dp(48)}.Constrain(c, cs))
cs = layout.Sized{Width: ui.Dp(48), Height: ui.Dp(48)}.Constrain(c, cs)
dims = widget.Image{Src: u.avatar, Rect: u.avatar.Bounds(), Scale: 1}.Layout(c, ops, cs)
dims = in.End(cc.End(dims))
}
c1 := f.End(dims)