Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

Commit

Permalink
[Android] Fix border clipping calculations (#10336) fixes #10269
Browse files Browse the repository at this point in the history
  • Loading branch information
PureWeen authored Apr 16, 2020
1 parent 8d47e7d commit 3d0108c
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,54 @@ protected override void Init()
Source = "coffee.png"
}
}
},
new Label()
{
Text = "The box view height should match the button border width"
},
new BoxView()
{
BackgroundColor = Color.Red,
HeightRequest = 2
},
new Button()
{
BorderColor = Color.Red,
BackgroundColor = Color.White,
CornerRadius = 25,
BorderWidth = 2
},
new Label()
{
Text = "The box view height should match the button border width"
},
new BoxView()
{
BackgroundColor = Color.Red,
HeightRequest = 5
},
new Button()
{
BorderColor = Color.Red,
BackgroundColor = Color.White,
CornerRadius = 25,
BorderWidth = 5
},
new Label()
{
Text = "The box view height should match the button border width"
},
new BoxView()
{
BackgroundColor = Color.Red,
HeightRequest = 1
},
new Button()
{
BorderColor = Color.Red,
BackgroundColor = Color.White,
CornerRadius = 25,
BorderWidth = 1
}
}
};
Expand Down
4 changes: 2 additions & 2 deletions Xamarin.Forms.Platform.Android/Renderers/BorderDrawable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,8 @@ public void DrawCircle(Canvas canvas, int width, int height, Action<Canvas> fini
// adjust border radius so outer edge of stroke is same radius as border radius of background
float borderRadius = Math.Max(ConvertCornerRadiusToPixels() - inset, 0);

RectF rect = new RectF(0, 0, width, height);
rect.Inset(inset + PaddingLeft, inset + PaddingTop);
RectF rect = new RectF(0, 0, width , height);
rect.Inset(PaddingLeft, PaddingTop);
path.AddRoundRect(rect, borderRadius, borderRadius, Path.Direction.Ccw);

canvas.Save();
Expand Down

0 comments on commit 3d0108c

Please sign in to comment.