widget: make border draw within widget dims as documented

Signed-off-by: Chris Waldon <christopher.waldon.dev@gmail.com>
This commit is contained in:
Chris Waldon
2021-01-19 07:49:08 -05:00
committed by Elias Naur
parent d6886737a5
commit 9231ff47ef
+6
View File
@@ -26,6 +26,12 @@ func (b Border) Layout(gtx layout.Context, w layout.Widget) layout.Dimensions {
rr := float32(gtx.Px(b.CornerRadius))
st := op.Save(gtx.Ops)
width := gtx.Px(b.Width)
sz.X -= width
sz.Y -= width
op.Offset(f32.Point{
X: float32(width) * 0.5,
Y: float32(width) * 0.5,
}).Add(gtx.Ops)
clip.Border{
Rect: f32.Rectangle{
Max: layout.FPt(sz),