W3C home > Mailing lists > Public > www-svg@w3.org > November 2009

Re: Pointer-events Suggestion

From: Alex Danilo <alex@abbra.com>
Date: Fri, 06 Nov 2009 13:06:25 +1100
Message-Id: <PI0OSK.A7PX9PLGF7X9@abbra.com>
To: "Ryan Maw" <RMaw@Forge-Industrial.com>
Cc: <www-svg@w3.org>
Hi Ryan,

--Original Message--:
>Hello, it's my understanding that this is the email address I should
>write to with a suggestion for an enhancement to the pointer-events spec
>in SVG. Please redirect if this is not the case.
>
>
>
>I am working on a SVG application that uses translucent rectangles.
>Clicking or hovering with the mouse pointer over a rectangle fires an
>event related to the specific rectangle. In many circumstances one
>rectangle is partially or completely overlapping another but because
>they are translucent the rectangle in the back can still be seen through
>the one in the front. In this situation it is quite intuitive for a user
>to click on the overlapping region and expect the events associated with
>both rectangles to be triggered. Indeed, this is the desired behaviour I
>want to program for. 
>
>The current pointer-events spec allows me to turn off the event capture
>on the upper rectangle by setting pointer-events="none" on this
>rectangle. This way the bottom rectangle receives the events. If I don't
>do this, then only the top rectangle gets the events. I desire BOTH
>rectangles to get the events but there seems to be no simple way to
>achieve this. I imagine setting the upper rectangle to something like:  
>
>pointer-events="spy"
>
>This would allow the top rectangle to catch events but then immediately
>release them to propagate to a rectangle beneath - the upper rectangle
>would be "spying" on events. I'm guessing this type of
>translucent-overlapping situation wasn't considered when the
>pointer-events spec was written. Adding a "spy" or "catch-and-release"
>type of behaviour would be valuable. Thank you for considering it.
>
>Ryan Maw, P.Eng.

You should be able to attach an event handler on both rectangles and
both will receive the event.

That is standard DOM event bubbling behaviour.

If you're not getting events on both rectangles, then it's
likely the user agent you're using is buggy.

Cheers,
Alex
Received on Friday, 6 November 2009 02:07:14 GMT

This archive was generated by hypermail 2.3.1 : Friday, 8 March 2013 15:54:43 GMT