Re: Pointer-events Suggestion

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:  
>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.


Received on Friday, 6 November 2009 02:07:14 UTC