Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed An issue with Microsoft.Maui.Animations when testing a custom busy indicator control. #26051

Merged
merged 1 commit into from
Nov 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading