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
Define default for layers + decide to use radians or degrees #73
Comments
/agenda what are good defaults for all the layers? |
During today's call I heard from @ada, @Manishearth and @toji that they prefer radians.
radians:
We still need to discuss the defaults so maybe we can go over it during that meeting. If noone else agrees with me, I will make the change. |
Worth noting that this particular topic felt like it got derailed a bit early, so the radians majority above may not be a complete picture. I do think it's a good topic to discuss along with the defaults, though. |
I will note (and I think @AdaRoseCannon mentioned this), APIs tend to have |
Alternatively, we can specify that distance and angle are represented by CSS units.
|
I don't know of any other API that does that, though it's an interesting idea. Remember that full CSS supports calc and variables and all kinds of nonsesnse in that context, and we probably don't want that. I'm not sure if the spec gives us the ability to distinguish, this is all parse time so if we want to refer to css' parsing algorithms we need a parsing context which we don't have. |
The DOMMatrix constructor uses it. I've seen other APIs but I can't find them at the moment. Just looking through github for CSS that uses angles, 15 pages in there was not a single example of using radians. |
Right, it uses degrees directly, not If you want examples of functions using radians: all of |
No. Look at the constructor. It takes a string that is parsed down with CSS rules. |
Oh, I forgot about that constructor. It seems underspecified, it doesn't say how to handle percentages, calc, and things like |
Section 2 of Parsing a string into an abstract matrix covers that. |
So choices are:
If we go with option 3, all distance units should probably also become CSS values. |
All distance units definitely should not become CSS values, CSS can only specify things in screen space, this is world space where we have a good established convention of using meters. CSS doesn't do "real units" that well, since it depends on the anchoring. I'd dispute the "preferred by developers" in the general because radians are more natural when you get them out of other calculations. However, for cylinder layers I would expect the number to be hardcoded, in which case degrees makes a little bit more sense as being preferred by the devs. But in that case i slightly feel like we should have "degrees" in the variable name to be clear. |
If the API takes a JS Number value, it should definitely be radians, to match with all the Math apis that consume or return angles. (Unless, as Manish said, the fact that it takes degrees is clearly specified in the name; I suppose that would be okay.) Taking a string that's a CSS value is... possible, but yeah, would be weird. Note that it's definitely possible to restrict it to just unit values, no calcs; that doesn't fall out of the simplest way to define the parsing, but it's straightforward to do so. Something like
|
Asked on the call and radians was a pretty overwhelming favorite. Rik said he'll make the spec change soon. |
Fixed in PR #92 |
/agenda Should centralAngle be in degrees or radians? See also here
The text was updated successfully, but these errors were encountered: