[whatwg] Usemap and ismap for canvas tag

I would like to request that the canvas element get the same usemap
and ismap properties that the img element has.

It seems the canvas tag was designed primarily for fairly simple
dynamic data visualizations, but even so, having some basic, built-in,
intuitive methods for interacting with these graphics would be nice.
Beyond, the standard image map, it would also be nice if after closing
a path you could add the shape created to the dom and give it an ID,
though I a may be pushing it with this request. You don't necessarily
need to be able to directly modify the shape itself via the dom (that
might be difficult since I think the canvases are drawn flattened on
one layer), but merely be able to add event listeners to that shape
such as onclick and mouseover. Basically what I am proposing is not
much different than an image map, but one where this virtual canvas
image map can be created with canvas commands rather than having to
draw the shape a second time and add it to the image map separately.

... draw shape ...
ctx.closePath(areaID)

vs.

... draw shape ...
ctx.closePath()
... draw shape again as an image map area ...
... inject newly created area into map

So merely giving the canvas element the usemap and ismap properties
would be helpful, though better yet if canvas shapes/areas could be
added to the dom directly.

The following is an example of a canvas pie chart with a dynamically
generated image map overlayed on top of it. Since the canvas element
does not as of yet have a usemap property I had to use a blank
transparent gif for the overlay.
http://demos.greghoustondesign.com/piechart/

Also, again realizing I am pushing it, in the modern world it would
probably be nice if there was an image map shape type that supported
bezier curves. In the example above the circumference of each pie
slice is approximated with several vertices.

Cheers,

Greg

Received on Monday, 3 March 2008 14:54:14 UTC