W3C home > Mailing lists > Public > www-svg@w3.org > September 2015

Re: pathLength="" affecting stroke dashing

From: Amelia Bellamy-Royds <amelia.bellamy.royds@gmail.com>
Date: Fri, 25 Sep 2015 00:01:39 -0400
Message-ID: <CAFDDJ7xTmxqtRne5jnZB_feRbyP11wj9URk20MfKo4hgZxbeDQ@mail.gmail.com>
To: www-svg <www-svg@w3.org>
Just a voice from the authoring side, it is currently really frustrating
that browsers (other than Firefox) do not scale stroke dashes to the
pathLength.  It makes it very difficult to arrange neat strokes that are
symmetrical at the ends of a line, and it makes it difficult to precisely
control the timing of stroke-drawing animations.

Currently, you need to use path.getTotalLength() (or do the geometry
calculations yourself for basic shapes), and then you need to overestimate
the length of a dash that will cover the entire path to account for
differences in path-length heuristics between browsers.  It would be much
easier if you could normalize the length with pathLength="100" or similar,
and work from there.  It is also, quite frankly, what authors *expect* the
pathLength attribute to do, from anyone I've ever discussed it with.
Having the attribute, but only having it affect animation and DOM methods,
seems a waste.

In other words, I'm really glad to see this new text in the spec & matching
test case.  I can't see it breaking any current content, especially seeing
as how Firefox already implements it this way.  But it does require updates
to the other implementations.

Amelia

On 24 September 2015 at 19:09, Cameron McCormack <cam@mcc.id.au> wrote:

> There was an issue in the Painting chapter to describe how the
> pathLength="" attribute affects stroke dashing.  I’ve fixed that in the
> spec, but upon testing I found that implementations differ.  Firefox
> (and old Presto Opera) do scale stroke-dasharray and stroke-dashoffset
> by the factor that results from pathLength="", while WebKit/Blink/Edge
> don’t.  I think it does make sense for pathLength="" to affect these, as
> anything that is specified relative to the length of the path should.
>
> I made an example that uses pathLength="" and dashing, which obviously
> looks “correct” in Firefox and not in other browsers:
>
>
> https://github.com/w3c/svgwg/blob/master/master/images/painting/dash-pathlength.svg
>
> Is this something that WebKit/Blink/Edge would be willing to fix?
>
> --
> Cameron McCormack ≝ http://mcc.id.au/
>
>
Received on Friday, 25 September 2015 04:02:13 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:55:03 UTC