[whatwg] Usemap and ismap for canvas tag

Greg Houston gregory.houston at gmail.com
Wed Mar 5 07:39:40 PST 2008


Hi Lachlan,

I am currently implementing the method you describe here:
http://demos.greghoustondesign.com/piechart/

Generally, the use of a blank transparent gif seems to me to be the
indication of a hack required due to some inadequacy of HTML and/or
CSS, e.g. old school table shims which are still often found in HTML
emails.

Though you can use image files with canvas, part of the appeal of the
canvas tag is not having to, and thus not having to make http server
requests for images. After making a graphic with the canvas tag, it's
a bit disappointing to have to place a gif on top of it. It's sort of
like buying a new economy size car only to find out that in order to
go anywhere with it you have to tow it with a truck.

As far as demand goes, most developers are still unaware of the
existence of the canvas tag, and then a large portion of those that
have heard of it do not realize there is a semi-functional way to get
it to work with Internet Explorer via ExCanvas or Moocanvas (minus
several gradient features). A lot of developers like myself will not
implement something if it is not supported by at least Firefox, Opera,
Safari, and Internet Explorer. There hasn't been a truly cross-browser
supported HTML graphics yet. VML, SVG, and Canvas have partial
coverage over the various browsers, but once SVG and Canvas are
supported without plugins or javascript bridges I think you will see
their use increase greatly. General developers don't want to jump
through hoops with javascript bridges and they don't want to make
their end users jump through hoops with plugins.

As the use of the canvas tag increases people are going to want to
interact with it. In our "Web 2.0" world, if you cannot interact with
your dynamic content there is a feeling that something is missing. We
like gadgets, widgets, little things with interactive features. We
want to unfold layers of information. Charts, graphs, and data
visualizations of all sorts are becoming increasingly common on the
web. The YUI javascript framework actually uses Flash to make graphs
with tooltips, but some of us would like to avoid the use of Flash as
much as possible.

Giving the canvas tag usemap and ismap properties gives the canvas
some small degree of interaction without requiring developers to jump
through quite so many hoops. Also, If a new developer starts reading
the documentation on the canvas tag and sees the usemap and ismap
properties listed it will help clarify somewhat the nature of the
canvas tag, that it is flat object, but that you can interact with its
parts using an overlay.

Here is one last personal example of the canvas tag with some basic
interactivity. I wanted to create a cross-browser method to create
rounded corners and drop shadows without images, again in order to not
have to load so many images. Usemap would have greatly simplified
giving functionality to my simple window controls.

http://greghoustondesign.com/demos/mocha/

On a side note, I was just glancing over the newly released, Internet
Explorer8 Readiness Toolkit, and it says: "Internet Explorer 8 offers
Web developers the opportunity to write standards-compliant HTML-based
Web pages that support features (such as SVG, XUL, and MathML) in
namespaces, provided that the client has installed appropriate
handlers for those namespaces via binary behaviors. (A binary behavior
is a type of ActiveX control.)"

I am not entirely sure what that means, but it looks like users will
still have to install something in order to view SVG with Internet
Explorer. There is no mention of canvas.

Cheers,

Greg


On Wed, Mar 5, 2008 at 7:46 AM, Lachlan Hunt <lachlan.hunt at lachy.id.au> wrote:
> Greg Houston wrote:
>  > I would like to request that the canvas element get the same usemap
>  > and ismap properties that the img element has.
>
>  One way this effect could be simulated is by overlaying a transparent
>  <img> over the top of the canvas, and appling the imagemap to that
>  instead.  Given that it's so trivial to work around it now, are there
>  sites that are actually doing that, or anything else that would indicate
>  some level of demand for this feature?  I'm not saying it's a bad idea,
>  I'm just trying to find out how much incentive there is for browser
>  vendors to implement a feature like this.
>
>  --
>  Lachlan Hunt - Opera Software
>  http://lachy.id.au/
>  http://www.opera.com/
>



More information about the whatwg mailing list