-
Notifications
You must be signed in to change notification settings - Fork 677
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-shapes-2] Add a shape() syntax, which accepts shape-segments equivalent to SVG path #5711
Conversation
Thanks for writing up the proposal! It might be better to put this into css-shapes-2, as everything in css-shapes-1 is a bit further along (with an implementation and tests), and we should likely get that finished in the process and push new work to the next level. @tabatkins can you take a look, since you have been responding in the issue? |
Of course, will move to css-shapes-2. |
SVG path segments. Fixes w3c#5674
@tabatkins this is an initial go at this, I'm sure it will require further examples and so, but wanted to align on the syntax. |
Looks nice! I like the by/to distinction, seems like a reasonable way to handle the rel/abs distinction. The only thing I don't like is the |
The thing is that with absolute coordinates, Something about the one-character EBNF feels less readable to me, but maybe just for h/v it's OK. |
Yeah, the one-character bit bothered me too, since the other commands aren't doing it (and dont' need to). What about |
LGTM! |
I recently amended my last comment in #5674 to mention alternative keywords: horizontal
|
Oh, I missed that! Not sure I like |
A couple of things I could use feedback about:
|
How about the algebra terms Or even |
New revision uses As for |
Additional advantages of |
But they would be confusing in absolute coordinates... e.g. |
New PR based on @smfr's comments and others:
|
@tabatkins I think it's ready for a review round. |
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. Lots of small editorial nits, but it's not worth going over in this review; I need to do an editorial pass over this entire spec.
Wait, spoke too soon, didn't notice the "corner" design. We should discuss that separately and make sure we're happy with the design there; I suggest dropping it from the initial proposal and just defaulting to the "standard" physical coordinate system that paths already use. |
Anyway, Agenda+ to discuss this addition to the spec. |
OK, I'll switch to physical - and will propose a separate discussion about logical coordinates in shapes. |
Won't make the call to discuss, but this LGTM too. I think a straight drop-in replacement for the existing SVG syntax is a good idea. For that reason I also agree with keeping logical coordinates well away is a good idea, at least or now. I'm also not sure about "corner" - given you can replace Otherwise, great! It's definitely better than string concatenation :-) (oh, a quick addendum re. one of your earlier comments - arcs are not directly replaceable with beziers, as they are treated differently when used with SVG markers: a 270° arc with end markers has just the two, but drawing the same curve with beziers would result in more. So the concept needs to remain in the grammar. Yes the syntax is awkward, but it's well established, and using |
Yes, the corner thing makes sense only in the context of logical coordinates. Will wait with that.
Good point, I didn't knot at! Though SVG markers don't play a role in CSS shapes. Do they? In which case, arcs and curves are interchangeable. |
True, currently. But (from w3c/svgwg#119 and w3c/svgwg#320) the "d" property uses the path() function (see also PR w3c/svgwg#374). Although it doesn't yet reference css-shapes, it seems to me that where <svg>
<style>
path {
d: shape(move to 0 0 arc to 100% 100% cw small 90deg);
marker-start: url(#marker);
marker-end: url(#marker);
}
</style>
<marker id="marker" markerWidth="10" markerHeight="10" refX="5" refY="5">
<circle cx="5" cy="5" r="5"/>
</marker>
<path></path>
</svg> Actually, that's another point - ideally the grammar for "arc" would allow the |
Yes I think making arc parameters order-agnostic would be better. Let me revise. |
Should I wait till it's discussed in the agenda or merge it in? |
Let’s wait for the discussion. There’s also the IPR commitment that needs to be made in some form or other. Are you talking to @svgeesus about that? |
I asked for the IPR commitment, and it has been made. I don't understand why the flag hasn't cleared. Ah! I had to press the "revalidate" button. All good now. |
Overall looks great!!! You need to also add yourself to the acknowledgements, though. =) |
Thanks!
How do I do that? |
Good point. Seems there isn't one yet. Need to add one, and add you to it. :) I suppose we can make that a separate issue. |
This reverts commit ec435e7.
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.
Typo Corresponds.
If it is not set, the automatic value is used. | ||
<dt>close | ||
<dd> | ||
Corrsepponds to a <a href="https://www.w3.org/TR/SVG/paths.html#PathDataClosePathCommand">closepath</a> command. |
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.
Typo. Corresponds.
<dt><dfn><<hv-line-command>></dfn> = [hline | vline] <<by-to>> <<length-percentage>> | ||
<dd> | ||
Corresponds to a horizontal or vertical <a href="https://www.w3.org/TR/SVG/paths.html#PathDataLinetoCommands">lineto</a> command. | ||
<dt><dfn><<curve-command>></dfn> = curve <<by-to>> <<coordinate-pair>> via <<coordinate-pair>>{1,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.
would prefer using
over via
. The curve does not go via the control points.
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.
Also, I wonder if the end point should come after the control points.
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.
Lastly (hopefully), additional spec text should point out that an animation of the shape
would work the same as SVG, but that curve
is a bit different since the type of curve is defined by the number of parameters (rather than an identifier like SVG).
Ha. @tabatkins merged before I pressed the "Submit Review" button. |
No worries, I'm gonna do a comprehensive edit pass over the spec anyway, so I'll make sure your comments are addressed. |
Add a draw() shape syntax, which accepts shape-segments equivalent to SVG path segments.
Fixes #5674