-
Notifications
You must be signed in to change notification settings - Fork 16
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
Make Num the default unit/length ? #17
Comments
I think I see but you might need to explain a bit more. Is it possible at the top-level element to set up whether you want units in "num", "mm", "px" or "em"? And once you have done so, you then don't need any units within that element. This sounds ok to me. Do you think anyone would find this overly restrictive in practice? Or is this generally considered good practice when working with SVG to pick one kind of unit and stick with it? |
Here is the Length type:
One problematic one might be Percent. I could set up a grid in Px, but I still might want to give a Length in Percent for something, for example. |
Yes, unitless values will follow whatever unit is set on the svg parent element. I only use mm for everything. It would simplify this library a bit. |
Also, when allowed to do mm/inch lengths both on Svg parent and on the children can cause unexpected behavior if you also use a viewbox for zoom/scaling: What I find great about Elm is that all packages are rethinked and made simpler and safer. If you really need another unit inside an SVG, it can be wrapped in another SVG element with different coordinate units ? |
I think that would work ok, assuming Percent is used less often. |
I'm all for simplifying things, but I think this would actually throw out some useful design tools. Some of these units scale with the window, or the text-size, or don't scale at all, which is a useful tool in the hands of a skilled designer (which I'm not, but I've worked with them, and they're criminally underappreciated). So I'm all for having a consistent length unit (one of I'm not sure if that's consistent with what's being proposed? |
@neganp :
So an example with pixel units would be:
(The idea is that you only specify (px 50)/(mm 50)/(pt 50) +++ on the svg element. (Same as today) |
Oh, nice. 🙂 Thanks for your reassurance. |
Is there a reason (Num/Float) is not the default length?
This would get rid of all the (num 50), (mm 50), (px 50) and (em 50) all over the place.
I would prefer to only use them at the Svg level.
The inEm and inPX modules could then also be removed.
If you choose your unit at the SVG level, then all parameters on children inside that SVG element will have the same unit if you don't specify one.
Or is it a normal requirement to want different units inside a single SVG element?
The text was updated successfully, but these errors were encountered: