Hi Selva,

news <[EMAIL PROTECTED]> wrote on 04/22/2006 07:41:35 AM:

> Now I created one group element (group_1) with 'symbol_1' and 
'Rectangle' 
> element with added mouse listeners in SVGRoot Element. If I try to move 
any 
> element within the "group_1", I should move whole "group_1". For this, I 
need 
> to get the "group_1" element using tree traversing from clicked element. 
Is 
> there any other way to access "group_1" element without traversing?

   I wouldn't worry about it.  Just make this a utility function
and call it where appropriate.  Traversal up the tree should take
almost no time.

   The other option is to register all your event listeners on the
'groups' then 'currentTarget' will be the element you set the
listener on, but if you have many such groups it will be easier to
simply do the tree traversal.

> Element rect = (Element)actionNode;
>   while (rect != null) {
>      if (rect.getParentNode() instanceof Element) {
>          rect = (Element)rect.getParentNode();
>      } else if (rect.getParentNode() instanceof SVGOMUseShadowRoot) {
>          SVGOMUseShadowRoot svrr = 
(SVGOMUseShadowRoot)rect.getParentNode();
>          rect = (Element)svrr.getCSSParentNode();
>      } else {
>          rect = null;
>      }
>      if (rect.getAttribute("id").startsWith("group")) {
>          break;
>   }
> }
> 
> Thanks,
> Selva
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


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

Reply via email to