Hi Urs,

Urs Reupke <[EMAIL PROTECTED]> wrote on 04/29/2007 03:25:22 AM:

> >> Is there a best practice for cases like this, or could/should I just 
> >> replace the interactors by another set
> >> of DOM listeners?
> >
> >    The best practice is to stick to DOM Event listeners when you can.
> > In this case the only slightly tricky bit is that you need to make 
sure
> > that the canvas is fully covered by something (often a 
visiblity="hidden"
> > rect with pointer-events="fill" that you ensure covers anything the 
canvas 
> > might show).   Then you can register your listener on the root SVG and
> > receive all mouse move events in the canvas.

> Following the list, I had already learned about that technique and 
> attempted to implement it. However, once the rectangle was in place, 
> it seemed that none of the "underlying" elements received any events 
> any longer. [...] I believe I could fix this by inserting the rectangle 
> as the first child of the root SVG element. Correct?

   Correct, right now the rect is 'on top' of everything so all events
are delivered to it.  If you make it the first child of the SVG element,
then it will be 'below' everything and it will only receive events if
they 'fall through' all the other elements in the document.

> What's more, I've experimented with the pointer-events property for a 
> bit in the hopes that it could solve another, simpler problem with 
> interaction.
> I have a set of two polygons that are defined as a symbol and referenced 

> troughout the document.
> Each reference is defined as an <g>-group to which first the 
> <use>-reference and then a <text> is added.
> Most of these references have the "fill" property set to a color, but 
> some remain at fill="none".
> This second class of unfilled polygons is causing me trouble, since I 
> seem unable to get events from them, even though
> I have (now) set pointer-events="visible" on the <use> element.

   This will only trigger events when they happen over 'visible'
parts of the element (this is in fact the default value).  Since 
your element doesn't have any fill the filled region isn't visible
and hence isn't sensitive to events.  You probably want
pointer-events="all" or "fill".

>  From the specification I take it that events should be triggered even 
> though the polygons are fill="none"d.
> Does my description bring to your mind any obvious mistakes I could have 

> made?

   Yes, you misunderstood the spec. ;)


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to