Skip to content

Commit

Permalink
fix(shape): prevent shapes from returning a negative desired size.
Browse files Browse the repository at this point in the history
  • Loading branch information
carldebilly committed Apr 26, 2021
1 parent ea0b254 commit 6ed4ac1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Uno.UI/UI/Xaml/Shapes/Shape.layout.cs
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,8 @@ private static (float x, float y) ComputeScaleFactors(Size geometrySize, ref Siz
}
else
{
x = (float)((renderSize.Width - strokeThickness) / geometrySize.Width);
var renderWidthWithStrokeThickness = Math.Max(renderSize.Width - strokeThickness, 0);
x = (float)(renderWidthWithStrokeThickness / geometrySize.Width);
}
if (geometrySize.Height < double.Epsilon)
{
Expand All @@ -654,7 +655,8 @@ private static (float x, float y) ComputeScaleFactors(Size geometrySize, ref Siz
}
else
{
y = (float)((renderSize.Height - strokeThickness) / geometrySize.Height);
var renderHeightWithStrokeThickness = Math.Max(renderSize.Height - strokeThickness, 0);
y = (float)(renderHeightWithStrokeThickness / geometrySize.Height);
}

return (x, y);
Expand Down

0 comments on commit 6ed4ac1

Please sign in to comment.