Hi Thomas,
thanks for your hints.
The canvas is in JSVGComponent.ALWAYS_DYNAMIC mode, our code for opening the
svg document looks like this:
// load svg file
String parser = XMLResourceDescriptor.getXMLParserClassName();
SAXSVGDocumentFactory df = new SAXSVGDocumentFactory(parser);
if (this.debug) log.debug(method + "used XML parser: '" +
parser + "'");
try
{
this.docMap = (SVGOMDocument)
df.createSVGDocument(svgURI); //
if (this.debug) log.debug(method + "SVG '" + svgFile +
"' loaded
successful.");
}
catch (java.io.IOException ioe)
{
log.error(method + "Error while creating SVG
Document:", ioe);
if (ioe.getMessage().indexOf("�") > 0)
{
log.error(method + "...(likely hex character at
end of file!)");
}
throw ioe;
}
// get the root element
this.docMapRoot = this.docMap.getRootElement();
// access to CSS style of root element
this.docMapStyle = (SVGStylable) this.docMapRoot;
// add listener for zoom/resize
// available events: http://www.w3.org/TR/SVG11/interact.html
final EventTarget t = (EventTarget) this.docMapRoot;
t.addEventListener("SVGResize", new OnResizeAction(), false);
t.addEventListener("SVGScroll", new OnScrollAction(), false);
// setup the SVG document and svgCanvas take note of changes
this.svgCanvas.setDocumentState(SVGMapCanvas.ALWAYS_DYNAMIC);
this.svgCanvas.setSVGDocument(this.docMap);
Is the setDocumentState() call at the right place? Or do we do this too early
or too late?
What do you mean with "the timeline thing"?
Regards,
Fabian
> Hi Fabian,
>
> Fabian Unfried <[email protected]> wrote on 03/15/2010 05:45:07 AM:
>
> > Maybe I didn't mention that exactly, my problem is that I have already
opened
> > a svg file in my application and then would like to add an animation, but
if
> > I do this like in your example, it won't be animated.
>
> I suspect the problem is that the canvas decided that it could use
> 'static' mode to render the document. If the Canvas does not see any
> dynamic elements/attributes in the document then it will not attach
> the necessary listeners/handlers to support dynamic modification of
> the document (including animation).
>
> You can force the canvas to be dynamic by calling
> the following _before_ loading the document:
>
> canvas.setDocumentState(JSVGComponent.ALWAYS_DYNAMIC)
>
> BTW it might also be the timeline thing (or both).
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]