forked from joejulian/gio
widget: ensure that Border.Layout dimensions fully contains the border
Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
+4
-3
@@ -25,11 +25,12 @@ func (b Border) Layout(gtx layout.Context, w layout.Widget) layout.Dimensions {
|
|||||||
|
|
||||||
rr := gtx.Dp(b.CornerRadius)
|
rr := gtx.Dp(b.CornerRadius)
|
||||||
width := gtx.Dp(b.Width)
|
width := gtx.Dp(b.Width)
|
||||||
sz.X -= width
|
whalf := (width + 1) / 2
|
||||||
sz.Y -= width
|
sz.X -= whalf * 2
|
||||||
|
sz.Y -= whalf * 2
|
||||||
|
|
||||||
r := image.Rectangle{Max: sz}
|
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,
|
paint.FillShape(gtx.Ops,
|
||||||
b.Color,
|
b.Color,
|
||||||
|
|||||||
Reference in New Issue
Block a user