Re: [svgwg] Rect decomposition is invalid (#753)

Reading your 2013 post, follow-up answers, and the 2013 minutes linked above, I have yet to read someone *in favor* of the current marker behavior. All opinions I read are people complaining about the current behavior, and people arguing that it can't be changed for backward compatibility.

Well, this can easily be solved by adding a new style attribute:

```marker-policy = openpath (default) | closedpath | subpaths```

- openpath: the whole path is treated as one open path for marker positioning, regardless of whether there are several subpaths, and whether these subpaths are open or closed. There is one `marker-start` at the first vertex of the path, one `marker-end` at the last vertex of the path, and one `marker-mid` on every other vertex. The orientation of a marker-mid at the start/end of a subpath takes into account the imaginary straight line between subpaths.

- closedpath: the whole path is treated as one closed path for marker positioning, regardless of whether there are several subpaths, and whether these subpaths are open or closed. There are no `marker-start` or `marker-end`. There is one `marker-mid` at the first vertex of the path, no marker at all at the last vertex of the path, and one `marker-mid` at the last vertex of the path, and one `marker-mid` on every other vertex. The orientation of a marker-mid at the start/end of a subpath takes into account the imaginary straight line between subpaths.

- subpaths: markers are positioned on a per-subpath basis, taking into account whether the subpath is open or closed. That is, open subpaths are individually markers as per the `openpath` policy, and closed subpaths are individually marked as per the `closedpath` policy. The orientation of a marker at the start/end of a subpath ignores other subpaths.

The default is openpath for backward compatibility, but any sane person should probably choose `subpaths`, and the standard might have a note saying that `subpaths` is recommended, and that the reason `openpath` is the default is for backward compatibility.

There is precedent in CSS for this type of things, for example the addition of [`box-sizing`](https://drafts.csswg.org/css-ui-3/#box-sizing) in CSS3, allowing authors to use a more sane behavior, as many people where complaining that the old behavior was broken.

This would still add duplicated markers for zero-length path segments (which I am actually in favor of), but using A1 as equivalent path for rectangles you don't have any of these zero-length path segments, so by setting `style="marker-policy:subpaths"` on this rect (or at the top of the document thanks to cascading), you get 0 marker-mid, 0 marker-end, and 4 marker-mid, as expected. Using the default `openpath` policy, you get 1 marker-start, 1 marker-end, and 3 marker-mid, as expected if the rectangle is treated as an openpath for marker positioning.

-- 
GitHub Notification of comment by dalboris
Please view or discuss this issue at https://github.com/w3c/svgwg/issues/753#issuecomment-561612382 using your GitHub account

Received on Wednesday, 4 December 2019 11:56:43 UTC