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

I30/svg in badge image background sometimes fails to render #32

Open
wants to merge 1 commit into
base: i28/badge-page
Choose a base branch
from
Open
Show file tree
Hide file tree
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
7 changes: 6 additions & 1 deletion SpeiderappPWA/Pages/Badges/Components/BadgeItem.razor
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,12 @@
</div>
<div class="badge-image-background @list">

@{ fraction = (double) numGreen / (double) numRequirements; }
@{ fraction = (double) numGreen / (double) numRequirements;
if (Double.IsNaN(fraction))
{
fraction = 1;
}
}

<svg>
<path d="M75,75 L75,0 A75,75 1 0,1 @RightBorderY(fraction), @RightBorderX(fraction) z"></path>
Expand Down
16 changes: 8 additions & 8 deletions SpeiderappPWA/Pages/Badges/Components/BadgeItem.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,33 +29,33 @@ protected override void OnInitialized()
Console.WriteLine($"{id}, {description}, {image}, {list}, {logo}, {complete}");
}

private double RightBorderY(double deg)
public double RightBorderY(double deg)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it necessary to make these public?

{
if (deg >= 0.5)
if (deg > 0.5 || Double.IsNaN(deg))
{
return 75.0;
}
return Math.Sin(-deg * Math.PI * 2 + Math.PI) * 75 + 75;
}
private double RightBorderX(double deg)
public double RightBorderX(double deg)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^

{
if (deg >= 0.5)
if (deg > 0.5 || Double.IsNaN(deg))
{
return 150;
}
return Math.Cos(-deg * Math.PI * 2 + Math.PI) * 75 + 75;
}
private double LeftBorderY(double deg)
public double LeftBorderY(double deg)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^

{
if (deg <= 0.5)
if (deg <= 0.5 || Double.IsNaN(deg))
{
return 150.0;
}
return Math.Sin(-deg * Math.PI * 2 + Math.PI) * 75 + 75;
}
private double LeftBorderX(double deg)
public double LeftBorderX(double deg)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^

{
if (deg <= 0.5)
if (deg <= 0.5 || Double.IsNaN(deg))
{
return 0;
}
Expand Down