widget,gesture: fade out cancelled inkwells

While here, adjust inkwell sizes to match gtx.Constraints.Min.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2020-06-08 23:47:40 +02:00
parent 36f4267a6c
commit ce56464923
5 changed files with 54 additions and 17 deletions
+4 -1
View File
@@ -2,6 +2,7 @@ package widget
import (
"image"
"time"
"gioui.org/gesture"
"gioui.org/io/pointer"
@@ -31,8 +32,10 @@ func (b *Bool) Layout(gtx layout.Context) layout.Dimensions {
for _, e := range b.gesture.Events(gtx) {
switch e.Type {
case gesture.TypeClick:
now := gtx.Now()
b.Last = Press{
Time: gtx.Now(),
Start: now,
End: now.Add(time.Second),
Position: e.Position,
}
b.Value = !b.Value