xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From poozle <jd...@bath.ac.uk>
Subject Re: On Click actions
Date Tue, 13 Nov 2007 12:08:55 GMT

Thanks very much Thomas, I thought I'd already set the canvas to dynamic at
some point in my code but looking back apparently not, works perfectly
without the animateMotion element now.

Jon


thomas.deweese wrote:
> 
> 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.
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/On-Click-actions-tf4796512.html#a13724583
Sent from the Batik - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Mime
View raw message