xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jonathan wood <jonathanshaww...@gmail.com>
Subject Re: Mouse EventListener on SVG group elements
Date Wed, 16 Feb 2011 17:13:18 GMT
Does your <g> specify the attribute pointer-events= "all"?

http://www.w3.org/TR/SVG/interact.html#PointerEventsProperty


Jonathan

2011/2/15 André de Brito <andre.brito@evolve.pt>

> 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
>>
>
>

Mime
View raw message