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

Non uniform corner radius support #769

Closed
wants to merge 4 commits into from

Conversation

rafael-rosa-knowcode
Copy link
Contributor

@rafael-rosa-knowcode rafael-rosa-knowcode commented Aug 29, 2023

GitHub Issue (If applicable): closes #735

#735
Related to #754

PR Type

What kind of change does this PR introduce?

  • Feature

What is the current behavior?

Today the ShadowContainer just have the uniform corner radius support

What is the new behavior?

Now the ShadowContainer have the non uniform corner radius support

image

Inner

image

PR Checklist

Please check if your PR fulfills the following requirements:

Other information

Internal Issue (If applicable):

Copy link
Contributor

@agneszitte agneszitte left a comment

Choose a reason for hiding this comment

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

@rafael-rosa-knowcode I think you made some tests for these changes no?

@github-actions
Copy link

github-actions bot commented Aug 29, 2023

Azure Static Web Apps: Your stage site is ready! Visit it here: https://polite-field-01aa64f0f-769.eastus2.azurestaticapps.net

@@ -175,6 +184,24 @@ public void ClipToContent(ShadowPaintState state, SKCanvas canvas)
canvas.ClipRoundRect(GetContentShape(state), antialias: true);
}

public static bool IsCornerRadiusProportional(CornerRadius CornerRadius)
Copy link
Contributor

Choose a reason for hiding this comment

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

rename parameter to CornerRadius cornerRadius

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@@ -175,6 +184,24 @@ public void ClipToContent(ShadowPaintState state, SKCanvas canvas)
canvas.ClipRoundRect(GetContentShape(state), antialias: true);
}

public static bool IsCornerRadiusProportional(CornerRadius CornerRadius)
Copy link
Contributor

Choose a reason for hiding this comment

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

move IsCornerRadiusProportional + GetPointsFromCornerRadius above ClipToContent
helper methods should be grouped together
also they are only used within this class, so you can just mark them as private
maybe consider dropping static, so you can just access local property

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.


public static SKPoint[] GetPointsFromCornerRadius(CornerRadius CornerRadius, float pixelRatio)
{
return new SKPoint[]
Copy link
Contributor

Choose a reason for hiding this comment

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

return new[] { CornerRadius.TopLeft, .TR, .BR, .BL }
.Select(x => (float)x * pixelRatio))
.Select(x => new SKPoint(x, x))
.ToArray();

Copy link
Contributor

Choose a reason for hiding this comment

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

maybe consider inline this into GetContentShape's else branch
since this is not reused, and doesnt really encapsulate much

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

Co-authored-by: Steve Bilogan <steve.bilogan@gmail.com>
@github-actions
Copy link

github-actions bot commented Aug 29, 2023

Azure Static Web Apps: Your stage site is ready! Visit it here: https://polite-field-01aa64f0f-769.eastus2.azurestaticapps.net

@github-actions
Copy link

github-actions bot commented Aug 29, 2023

Azure Static Web Apps: Your stage site is ready! Visit it here: https://polite-field-01aa64f0f-769.eastus2.azurestaticapps.net

@github-actions
Copy link

github-actions bot commented Aug 29, 2023

Azure Static Web Apps: Your stage site is ready! Visit it here: https://polite-field-01aa64f0f-769.eastus2.azurestaticapps.net

@agneszitte
Copy link
Contributor

@Mergifyio backport legacy/3x release/stable/3.1

@mergify
Copy link
Contributor

mergify bot commented Aug 29, 2023

backport legacy/3x release/stable/3.1

🟠 Waiting for conditions to match

  • merged [:pushpin: backport requirement]

@agneszitte
Copy link
Contributor

Closed in favor of #757

@agneszitte agneszitte closed this Aug 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ShadowContainer] Non uniform corner radius support
5 participants