Hit regions and WebGL...

It was recently pointed out in another thread that there is a lack of
consideration for WebGL use cases in the design of the canvas hit region
APIs.

I would like to reboot the discussion on this mailing list where much of
the discussions on the hit regions spec has taken place in the past.

Three issues with the current spec:

   1. The API methods are on the CanvasRenderingContext2D (no WebGL). They
   could be either moved to HTMLCanvasElement, or moved to a sub-interface
   that is implemented by both CanvasRenderingContext2D and
   WebGLRenderingContext (and any other place they're wanted)
   2. There is a dependency on the current path and current transform of
   the 2d rendering context. That information could be passed in as
   HitRegionOptions fields instead. Also, passing the transform as a DOMMatrix
   would allow general 3D transforms to be applied, which would be desireable
   for WebGL. In the whatwg edition of the spec, there is already a 'path'
   field in HitRegionOptions that takes a Path2D object (another whatwg-ism).
   3. (Not related to WebGL) The event processing model is inconsistent
   with other APIs.  That part of the spec should probably be re-written to
   re-use existing platform features. For example, hit regions could be
   ordinary event targets. Also, the 'region' event member name is perhaps too
   generic.

AFAIK, no browsers have yet shipped any hit region APIs, so there is still
an opportunity to make major changes without breaking the Web.  Shipping in
Chrome is possibly imminent, but we are almost certainly going to put it on
hold to take the necessary time resolve the issues mentioned above.

Thoughts?

    -Justin

P.S.: Original thread was in a whatwg issue, here:
https://github.com/whatwg/html/issues/1030

Received on Tuesday, 12 April 2016 20:53:41 UTC