OK, then I'm doing something wrong and I need to explain a little more.

I have a single listener that's attached to the entire document.  I want
to drag and drop objects around my SVG document with few exceptions:

<svg id="...">

   (This rectangle is here specifically to provide a background color).
   <rect type="background" id="..." ... />

   (Special metadata is included as an attribute to define this element
as a layer).
   <g type="layer" id="...">

      (Each of these children can be dragged and dropped)
      <rect id="..." pointer-events="visible" ... />
      <ellipse id="..." pointer-events="visible" ... />
      <line id="..." pointer-events="visible" ... />

      (Special metadata is included as an attribute to define this
element as a group.
       I want to drag and drop the GROUP, not the elements within!  I
know this doesn't
       work, but this is what I currently have.  I tried to make the
individual elements
       ignore events so the <g> would receive them.  Obviously it didn't
work; the
       background rect receives the event.)
      <g type="group" id="..." pointer-events="visible">
         <circle pointer-events="none" ... />
         <line pointer-events="none" ... />
      </g>
   </g>
</svg>

I want any clicks on the group's children to bubble up to the group, but
it sounds like that's not possible with a single listener.  Is there a
way I can customize or work around that?  I'm thinking that if an
element does not have an "id" node, it bubbles up until it hits a parent
that does?

Michael Bishop
 

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
> On Behalf Of Archie Cobbs
> Sent: Thursday, January 03, 2008 4:08 PM
> To: [email protected]
> Subject: Re: Pointer events for a <g> tag?
> 
> Not sure what you're asking exactly, but mouse events have a 
> bubble phase during which they pass upwards in the DOM to the 
> root node.
> 
> If you listen for mouse events on the <g> tag (only), you'll 
> receive them there when they bubble up from the rect, 
> ellipse, and line nodes. 
> 
> 
> On Jan 3, 2008 3:03 PM, Bishop, Michael W. CONTR J9C880 
> <[EMAIL PROTECTED]> wrote:
> 
> 
>       Given the following:
>       
>       <g pointer-events="visible">
>         <rect .../>
>         <ellipse .../>
>         <line .../>
>       </g>
>       
>       I want to treat the inner elements of the <g> tag as a 
> single entity.  I 
>       want to be able to drag and drop them as a single 
> element.  I thought
>       wrapping them in a <g> tag and having the <g> tag 
> respond to pointer
>       events was the solution.  Upon further research, it 
> seems pointer events 
>       only work for graphics elements and a <g> tag isn't 
> technically rendered
>       to the screen.
>       
>       So how can I treat this group of elements as a single 
> "group" and have
>       them respond to pointer events as a whole? 
>       
>       Michael Bishop
>       
>       
> ---------------------------------------------------------------------
>       To unsubscribe, e-mail: 
> [EMAIL PROTECTED] 
>       For additional commands, e-mail: 
> [EMAIL PROTECTED]
>       
>       
> 
> 
> 
> 
> --
> Archie L. Cobbs
> 
> 

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

Reply via email to