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
+3 -1
View File
@@ -91,6 +91,8 @@ func (s SwitchStyle) Layout(gtx layout.Context) layout.Dimensions {
},
NE: rr, NW: rr, SE: rr, SW: rr,
}.Op(gtx.Ops).Add(gtx.Ops)
dims := image.Point{X: trackWidth, Y: thumbSize}
gtx.Constraints.Min = dims
drawInk(gtx, s.Switch.Last)
stack.Pop()
@@ -108,7 +110,7 @@ func (s SwitchStyle) Layout(gtx layout.Context) layout.Dimensions {
s.Switch.Layout(gtx)
stack.Pop()
return layout.Dimensions{Size: image.Point{X: trackWidth, Y: thumbSize}}
return layout.Dimensions{Size: dims}
}
func drawDisc(ops *op.Ops, sz float32, col color.RGBA) {