xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thomas.dewe...@kodak.com
Subject Re: On Click actions
Date Tue, 13 Nov 2007 11:41:04 GMT
Hi Jon,

poozle <jdb25@bath.ac.uk> wrote on 11/13/2007 03:50:35 AM:

> And I have my program set up to add on event click listeners to each
> individual group:
> 
> for(int i = 0; i < Shape.shapes.size(); i++){
>     Element elt = Shape.doc.getElementById("shape" + i);
>     EventTarget t = (EventTarget)elt;
>     t.addEventListener("click", new OnClickAction(i), false);
> }
> 
> With this setup my code doesn't actually detect the clicks,

    This is most likely because Batik can't tell that this
is supposed to be a dynamic document so it builds it as
a static document (which saves some time and memory).
This is easily fixed by calling:

        canvas.setDocumentState(ALWAYS_DYNAMIC);

    Before you associate the document with the canvas.

> I have a work around where I add an animateMotion element attached 
> to the group (after path)

   The addition of the animateMotion element(s) let's Batik know
that this is a dynamic document, so then your event listeners
work correctly.


Mime
View raw message