Skip to content

Commit

Permalink
fix: Adjust rendering on Android for StrokeThickness
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinZikmund committed Nov 9, 2022
1 parent b72499c commit bf6a30c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
10 changes: 8 additions & 2 deletions src/Uno.UI/UI/Xaml/Shapes/Shape.Android.cs
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,14 @@ protected Windows.Foundation.Size BasicArrangeOverride(Windows.Foundation.Size f

if (renderingArea.Width > 0 && renderingArea.Height > 0)
{
var logicalRenderingArea = TransformToLogical(renderingArea);

var fullRenderingArea = TransformToLogical(renderingArea);
var halfActualStrokeThickness = ActualStrokeThickness / 2;
var logicalRenderingArea = new Windows.Foundation.Rect(
fullRenderingArea.X + halfActualStrokeThickness,
fullRenderingArea.Y + halfActualStrokeThickness,
fullRenderingArea.Width - ActualStrokeThickness,
fullRenderingArea.Height - ActualStrokeThickness);

if (!_logicalRenderingArea.Equals(logicalRenderingArea))
{
_logicalRenderingArea = logicalRenderingArea;
Expand Down
8 changes: 0 additions & 8 deletions src/Uno.UI/UI/Xaml/Shapes/Shape.layout.cs
Original file line number Diff line number Diff line change
Expand Up @@ -211,14 +211,6 @@ private protected (Size shapeSize, Rect renderingArea) ArrangeRelativeShape(Size
}
}

//// For the Rectangle and the Ellipse, half of the StrokeThickness has to be excluded on each side of the shape.
//var twoHalfStrokeThickness = ActualStrokeThickness;
//var halfStrokeThickness = twoHalfStrokeThickness / 2.0;
//renderingArea.X += halfStrokeThickness;
//renderingArea.Y += halfStrokeThickness;
//renderingArea.Width -= twoHalfStrokeThickness;
//renderingArea.Height -= twoHalfStrokeThickness;

return (LayoutRound(size), LayoutRound(renderingArea));
}

Expand Down

0 comments on commit bf6a30c

Please sign in to comment.