Re: Mouse EventListener on SVG group elements

André de Brito <[email protected]>
Newsgroups gmane.text.xml.batik.user
Message-ID <[email protected]>
Sorry to insist, but does anyone have a clue on this subject? Or can you at
least point me to some other place where I can ask for help?

Thanks.

---

> Hello,
>
> I'm using batik to display SVG files on a JSVGCanvas and I'm trying to
> respond to mouse click events over SVG elements with tags <a>
> (SVGOMAElement) and <g> (SVGOMGElement).
> Here is the code I'm using to add the event listener to a Node:
>
> if ((no.getNodeName().equalsIgnoreCase("a")) ||
> (no.getNodeName().equalsIgnoreCase("g"))) {
>     EventTarget etr = (EventTarget) no;
>     etr.addEventListener(SVGConstants.SVG_EVENT_CLICK, new EventListener()
> {
>                     public void handleEvent(Event evt) {
>                         Log.debug("HANDLE EVENT");
>                     }
>     }, false);
>
> What happens is that the listener is correcly called when an <a> element is
> clicked, but nothing happens when a <g> element is clicked!
> I debuged the code above and verified that the "click" listener is being
> added to the both node's bubblingListeners table
> (etr->eventSupport->bubblingListeners). However, I noticed that the <a>
> elements seem to have two other (default) listeners - for events "mouseout"
> and "mouseover" - which are not present on the <g> elements. I don't believe
> this is the cause, but ...
>
> Any ideas on what could be causing this behaviour?
>
> Regards,
> ABrito
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.