[whatwg] Hit region + fillRule concerns
simon.sarris at gmail.com
Tue Jan 15 13:40:31 PST 2013
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
3. The fillRule of a hit region changes dynamically as
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.
More information about the whatwg