Ron King wrote:


Hi All,
I've looked for an example of handling events, but I still can't figure it out! I made the method below
to add a listener for _EACH_ path in an svg file (I'm doing this in Batik Squiggle, after a document is loaded):

You probably need to tell squiggle to load your document as a dynamic document: canvas.setDocumentState(JSVGCanvs.ALWAYS_DYNAMIC) Normally if Batik doesn't see event attributes or script elements it assumes it is a static document. This must be done before the document is loaded.

  Additionally you may want to look into:
        getElementsByTagNameNS to get the path elements.
  You should probably check for SVGPathElement not SVGOMPathElement
(our internal implementation), finally you already have the element
why are you looking it up by 'id'?  Just cast it to an EventTarget.


EventTarget t = (EventTarget) (e.getSVGDocument().getElementById(pathId));
t.addEventListener("click", onClick, true);




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



Reply via email to