W3C home > Mailing lists > Public > whatwg@whatwg.org > December 2009

[whatwg] Passing mouse events through the transparent parts of a <canvas> tag

From: Gregg Tavares <gman@google.com>
Date: Mon, 7 Dec 2009 16:32:36 -0800
Message-ID: <de4bd3190912071632j4d054ef7h825f96c33e19e1e2@mail.gmail.com>
Excuse me if this has already been discussed

Has there been a proposal for allowing mouse events to go through a canvas
element where it is transparent to the element below?

As an example, assume you have a canvas element with a triangle rendered
into the top left corner so that half the canvas is opaque and half the
canvas is 100% transparent (Alpha = 0).  That canvas is zIndexed to be above
other HTML. It would be nice if it was possible to interact with the visible
html under the transparent part of the canvas but as it is now all browsers
treat the canvas as a rectangle and ignore its transparency so that if the
user attempts to interact with the clearly visible HTML nothing happens.

One solution that comes to mind is to add an option (css?) that tells the
browser "if alpha = 0 at the place the user clicks then pass the event
through to the element below"

As a CSS option this could really apply to any tag. <img> for example.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/attachments/20091207/8fd031b7/attachment-0001.htm>
Received on Monday, 7 December 2009 16:32:36 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:19 UTC