widget: ensure that Border.Layout dimensions fully contains the border

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2022-07-10 14:59:50 +02:00
parent 162250392b
commit 53da73de35
+4 -3
View File
@@ -25,11 +25,12 @@ func (b Border) Layout(gtx layout.Context, w layout.Widget) layout.Dimensions {
rr := gtx.Dp(b.CornerRadius)
width := gtx.Dp(b.Width)
sz.X -= width
sz.Y -= width
whalf := (width + 1) / 2
sz.X -= whalf * 2
sz.Y -= whalf * 2
r := image.Rectangle{Max: sz}
r = r.Add(image.Point{X: width / 2, Y: width / 2})
r = r.Add(image.Point{X: whalf, Y: whalf})
paint.FillShape(gtx.Ops,
b.Color,