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

Reply via email to