-
Notifications
You must be signed in to change notification settings - Fork 11.9k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Enhance the rounded rectangle implementation #5597
Conversation
Use `arcTo` instead of `quadraticCurveTo` (both methods have the same compatibility level) because it generates better results when the final rect is a circle but also when it's actually a rectangle and not a square. This change is needed by the datalabels plugin where the user can configure the `borderRadius` and thus generate circle from a rounded rectangle.
// NOTE(SB) `epsilon` helps to prevent minor artifacts appearing | ||
// on Chrome when `r` is exactly half the height or the width. | ||
var epsilon = 0.0000001; | ||
var r = Math.min(radius, (height / 2) - epsilon, (width / 2) - epsilon); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -222,7 +222,7 @@ describe('Point element tests', function() { | |||
15 - offset, | |||
Math.SQRT2 * 2, | |||
Math.SQRT2 * 2, | |||
2 / 2 | |||
2 * 0.425 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe a comment here explaining what 0.425
is would be helpful
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 / 2
wasn't explained, you need to read the roundedRect
method to understand why and that's the same for 0.425
, which one is properly explained in the method body. I don't think we should duplicate the comment here since it's exactly the same value in the calling code.
Use `arcTo` instead of `quadraticCurveTo` (both methods have the same compatibility level) because it generates better results when the final rect is a circle but also when it's actually a rectangle and not a square. This change is needed by the datalabels plugin where the user can configure the `borderRadius` and thus generate circle from a rounded rectangle.
Use
arcTo
instead ofquadraticCurveTo
(both methods have the same compatibility level) because it generates better results when the final rect is a circle but also when it's actually a rectangle and not a square. This change is needed by the datalabels plugin where the user can configure theborderRadius
and thus generate circle from a rounded rectangle.