Re: hit regions

On Mon, Aug 20, 2012 at 3:29 AM, Rik Cabanier <cabanier@adobe.com> wrote:
> Thanks Benjamin. There's a lot of history here.
>
> Is there a discussion anywhere where pixel based hit regions are elected in place of path based ones?
> I couldn't find any email about this apart from one on the WHATWG mailing list.
>
> FYI since I was selected as an editor, I'm trying to get up to speed on the Canvas2d spec. This topic seems to generate most of the email traffic and I want to understand the design decisions.

I suggest talking directly to Hixie about his design decisions, but …

Background discussion on WHATWG IRC:

http://krijnhoetmer.nl/irc-logs/whatwg/20120225#l-52

With respect to your specific questions:

> 1.       This set of APIs says that each region controls a set of pixels. Doesn’t this imply that you won’t be able to have intersecting regions?

You can't have two regions registered for the same pixels AFAICT.

> This seems like a big limitation.

[snip]

> Wouldn’t it be better to just keep the paths?

Dunno. What's the practical difference between keeping a path and
keeping a bitmap described by a path?

> Another issue would be with removing hit regions that previously overlapped others. How would you restore the previous pixels?

"You" being who? The author? The browser?

The WHATWG spec for "removeRegion" says:

"The pixels that were covered by this region and its descendants are
effectively cleared by this operation, leaving the regions
non-interactive. In particular, regions that occupied the same pixels
before the removed regions were added, overlapping them, do not resume
their previous role."

A key design goal, as I understand it, was to avoid turning canvas
into a retained mode API. The author is responsible for managing any
object graph; canvas is just a display.

> 2.       Are hit regions subjected to the current clipping region? The newly introduced ‘current default path’ doesn’t say so but it seems like it should.

Pass.

> 3.       There is nothing specific to canvas about hit regions. Would it make sense to extend them later to other content such as images?

Maybe, but not without use cases.

--
Benjamin Hawkes-Lewis

Received on Monday, 20 August 2012 03:40:01 UTC