[whatwg] Hit region + fillRule concerns

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:
http://lists.w3.org/Archives/Public/public-canvas-api/2013JanMar/0001.html

-------------

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
this.

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