Skip to content
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

[css-values] Add pl unit for SVG path length #221

Open
tabatkins opened this issue Jun 22, 2016 · 4 comments
Open

[css-values] Add pl unit for SVG path length #221

tabatkins opened this issue Jun 22, 2016 · 4 comments

Comments

@tabatkins
Copy link
Member

tabatkins commented Jun 22, 2016

SVG defined percentages in the dashing properties to be relative to the scaled viewport size (which is useless in most cases), but there are good use-cases for doing dashes relative to the path length, too. In particular, the common "make it look like it's drawing itself" hack needs that; right now you have to guess about path length or use JS to calculate and set it manually.

Since we can't change percentages now, and doing a mode-switch to change the meaning of percentages dynamically is a bit of an anti-pattern, the better solution is to introduce a new unit for path length. Similar to the other "percent-like" viewport units, a path should be 100pl long.

Thoughts on naming?

@tabatkins
Copy link
Member Author

(Context: w3c/svgwg#177 (comment))

@nikosandronikos
Copy link
Member

nikosandronikos commented Jun 22, 2016

Actually percentages are currently relative to the viewport, which is totally useless.

@tabatkins
Copy link
Member Author

Ugh, that's dumb. All the more reason to do this correctly.

@AmeliaBR
Copy link
Contributor

As I've discussed on the SVGwg issue, I am not convinced that a new unit is the best way to address this issue:

  • I would like to eventually extend the stroke dashing properties to allow dashing patterns relative to path segment or sub-path length.
  • The switch to segment or sub-path dash patterns would affect more than just the resolution of lengths (dashing would be calculated for each section of the path separately), so adding more units would not cover those use cases. Plus, a whole suite of SVG-specific units clutters up CSS Values.
  • There are very few properties where you would be able to use these units, other than stroke-dasharray, stroke-dashoffset. You certainly couldn't use them in SVG geometry properties, which change the path length. Motion path offset could use them, but motion path already defines percentages relative to path length. The proposed SVG marker-pattern property, which uses a dasharray-like syntax would use them. But again, we could just define percentages to be useful from the start. And there would still be a use case for lengths relative to segment or sub-path.

@fantasai fantasai added css-values-4 Current Work and removed css-values-3 labels Jul 20, 2016
@AmeliaBR AmeliaBR added SVG css-values-4 Current Work and removed css-values-4 Current Work labels Mar 19, 2018
@tabatkins tabatkins added css-values-5 and removed css-values-4 Current Work labels Jun 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants