Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Add conic-gradient #6661
Add conic-gradient #6661
Changes from 13 commits
c34a139
2263557
27a4c5c
c464652
2f236c9
7429bc0
44daada
b44ec37
c3238b9
be3c905
aad64f0
7ac879d
68eb67d
c404de9
15686d4
8bb28c0
5dee3b5
f3d6c6e
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Nit: indentation and wrapping is off and misses an end tag.
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.
I don't see where it has been defined that
angle
should be in degree.In #5431 (comment) @nt1m was asking if this should be in radians or degrees, but it seems there hasn't been any response in that thread, and given current Nightly still uses radians in the implementation, I guess they haven't been made aware of that decision to use degrees.
For what it's worth, if it's still time to have this discussion, I feel as a web-author that having the angle in degrees is very confusing: If I'm not mistaken, it is the only place in the whole canvas API that we would have an angle expressed in degrees instead of in radians. So if we want to play with that angle and e.g the transformation of the context, or the start/end angles of an ellipse, we'd have to convert between degrees and radians, not to mention the mental gymnastic of remembering where to use what...
If the goal was to have a simpler mapping from CSS, then note that only the <angle>
0
can have the unit omitted, and that CSS has arad
unit.Note that there is already a discrepancy with
arc
(andellipse
), where bothstartAngle
andendAngle
are relative to the x-axis, while CSS conic gradients asks that "0deg points to the top of the page", but that one sounds a bit less dramatic to me.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.
(@Kaiido to be clear, now is definitely the time. Thanks for raising this! See also https://whatwg.org/working-mode#changes if you want to get more familiar with the process in general.)
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.
+1 for radians. I'm not an expert, but all the JS APIs I know of use (e.g. the
Math
functions) use radians, and canvas should definitely be internally consistent.The inconistency between axes does seem problematic though. Would it make sense to make the mapping
(startAngle + Math.PI / 2)
radians so that it matches other canvas APIs? We could also even add a counterclockwise boolean like those APIs have.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.
I implemented this many months ago and cannot remember why I chose degrees. I think I was trying to match some CSS behaviour.
I also would prefer radians, personally. +1 to rotating everything by PI/2 as well to match
arc
andellipse
.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.
Strong agree that an angle number without additional type info should be interpreted as radians, coming from a JS API.
Argh at the mismatch of canvas api start angle. CSS copied from SVG, using "bearing angles". I think we should match existing canvas precedent here.
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.
I am so glad we have this discussion here now before i change more Canvas API.
+1 for radians and rotating everything by PI/2. Canvas API should be consistent. Changing spec. I will also change our implementation to map this.
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.
Nit: exceeds a 100 columns.
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.
It looks like the convention (e.g. in https://html.spec.whatwg.org/#flow-content-3:is-modal) is to wrap CSS expressions in single quotes
'
.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.
Does anything need to be said about the coordinate spaces involved? Like, are CSS pixels the same as the canvas pixels?
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.
if it helps the clarification, i can add something. I see
CSS pixel
defined and used in Canvas, (ex: actualBoundingBoxRight). I can may add it in the previous paragraph where i explain what isx
andy