Skip to content

Commit

Permalink
Fixed An issue with Microsoft.Maui.Animations when testing a custom b…
Browse files Browse the repository at this point in the history
…usy indicator control. (#26051)
  • Loading branch information
NirmalKumarYuvaraj authored Nov 28, 2024
1 parent d76e3cc commit 0531642
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/Graphics/src/Graphics/Platforms/MaciOS/PlatformCanvas.cs
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,13 @@ protected override void PlatformDrawLine(float x1, float y1, float x2, float y2)
_context.SetShouldAntialias(true);
}

// Normalize the angle to be between 0 and 2PI
float NormalizeAngle(float angle)
{
var twoPi = MathF.PI * 2;
return (angle % twoPi + twoPi) % twoPi;
}

protected override void PlatformDrawArc(float x, float y, float width, float height, float startAngle, float endAngle, bool clockwise, bool close)
{
_rect.X = x;
Expand All @@ -414,14 +421,9 @@ protected override void PlatformDrawArc(float x, float y, float width, float hei

if (!_antialias)
_context.SetShouldAntialias(false);
var startAngleInRadians = GeometryUtil.DegreesToRadians(-startAngle);
var endAngleInRadians = GeometryUtil.DegreesToRadians(-endAngle);

while (startAngleInRadians < 0)
startAngleInRadians += MathF.PI * 2;

while (endAngleInRadians < 0)
endAngleInRadians += MathF.PI * 2;
var startAngleInRadians = NormalizeAngle(GeometryUtil.DegreesToRadians(-startAngle));
var endAngleInRadians = NormalizeAngle(GeometryUtil.DegreesToRadians(-endAngle));

if (width == height)
{
Expand Down

0 comments on commit 0531642

Please sign in to comment.