W3C home > Mailing lists > Public > whatwg@whatwg.org > January 2013

[whatwg] Hit region + fillRule concerns

From: Simon Sarris <simon.sarris@gmail.com>
Date: Tue, 15 Jan 2013 16:40:31 -0500
Message-ID: <CAA5isUY8W_=a+tZg-FdjdwjyXhWqtwoctw2b7afUOHOxtqBZLw@mail.gmail.com>
To: whatwg@lists.whatwg.org
I replied to Rik Cabanier over on the W3 mailing list and figured I should
post here as well since nobody seems to look at the W3 Canvas list.

For the record I'm referring to:


The current *fillRule *rules in the specification seem incomplete or at
least ill-defined with respect to consideration of hit regions.

The new hit regions use a *Path* in the *HitRegionOptions* (the argument to
*addHitRegion*) in order to function, but its not clear what fill rule these
*Path* objects are using for hit-testing. Even-odd and winding fill rules
create different holes in a path, so it matters a good deal for hit testing.

There seem to be three possibilities as implemented:

   1. HitRegions only ever use winding paths. This seems like a bad idea.
   2. Whichever *fillRule* is defined when *context.addHitRegion* is called
   determines the *fillRule *for that hit region's *Path *permanently. This
   seems acceptable but confusing and should be clarified if it is currently
   the case.
   3. The fillRule of a hit region changes dynamically as
*context.fillRule* changes.
   This would be a nightmare.

I hope that right now it is #2, but the specification makes no mention of

Actually, I'd prefer that either *HitRegionOptions *or the *Path *object
would need to have a *fillRule *attribute.

If the specification does adopt something similar to Cabanier's suggestions
then that would need to be done anyway.

In short, if fill() and *isPointInPath() are* changed to specify *fillRule*
, then *HitRegionOptions* (the argument to *addHitRegion*) or the *Path* given
in the options needs to change too.

Simon Sarris
Received on Tuesday, 15 January 2013 21:40:57 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:52 UTC