-
Notifications
You must be signed in to change notification settings - Fork 11.9k
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
Fix arc border with circumference over 2*PI #6215
Conversation
src/elements/element.arc.js
Outdated
ctx.fillStyle = vm.backgroundColor; | ||
|
||
if (vm.circumference > Math.PI * 2) { |
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.
Looks good in case 0 <= circumference <= 2*PI
and 2*PI < circumference <= 4*PI
, but appearance is not consistent when circumference > 4*PI
. How about looping this part (endAngle - startAngle) / (Math.PI * 2)
times?
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.
Loop implemented, did some more refactoring to keep CC (and me) happy 😄
Demo updated.
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.
Instead of a loop would doing % 2PI
be more efficient?
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.
@etimberg that was my initial approach, but with transparency it is not consistent with circumference > 4*PI.
Not sure if anyone is going to use circumference that high anyway, but now its drawn consistently.
Fixed drawing of borders. But in 2 steps instead of 3, first fully open full circles and then fully closed partial. |
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.
Fixes: #6171
Demo