From 9231ff47efc57f4e56e18794aeee8a7d4a7bbf62 Mon Sep 17 00:00:00 2001 From: Chris Waldon Date: Tue, 19 Jan 2021 07:49:08 -0500 Subject: [PATCH] widget: make border draw within widget dims as documented Signed-off-by: Chris Waldon --- widget/border.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/widget/border.go b/widget/border.go index 86e356da..c3f6ede7 100644 --- a/widget/border.go +++ b/widget/border.go @@ -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),