I think I might have the answer. I use a crude undo function to reset the document, but found the render to reset each time. Here's what worked for me:
In your extended JSVGCanvas, place an instance field to store the last render transform, and create getter/setter. In the constructor, set the identity transform since this is the default when the canvas is first booted. Then override svgLoadEventDispatchCompleted with a call to setRenderingTransform, which in turn you've already overridden per recent threads.
When this is all prepared, call svgCanvas.setLastRender(svgcanvas.getrenderingtransform) (or use whatever transform you wish) and the canvas will automatically reset.
I can't tell you how much time it took to test the rendering transform in all the event listeners...it's instructive but it would have been extremely helpful to have a concise reference for the complete JSVGCanvas event sequence. Hope this helps some others out there...
public class JSVGCanvasX extends JSVGCanvas {
private AffineTransform lastRender = new AffineTransform();
public JSVGCanvasX() {
lastRender.setToIdentity();
this.addSVGLoadEventDispatcherListener(new SVGLoadEventDispatcherAdapter() {
public void svgLoadEventDispatchCompleted(SVGLoadEventDispatcherEvent e){
//set the rendering transform here, after SVGDocument is loaded but before rendering occurs
//canvas transform resets to identity before this event is fired
setRenderingTransform(getLastRender());
}
}
...etc.
}
Dan Slater
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]-------- Original Message --------
Subject: Rendering transform on refresh?
From: "Bishop, Michael W. CONTR J9C880" <[EMAIL PROTECTED]>
Date: Tue, October 28, 2008 3:41 pm
To: <[email protected]>
I have a refresh function in my application that simply calls setDocument() on the JSVGCanvas with the document already there, basically causing it to reset to its default state without zoom/pan/rotate.
I'm also tracking changes to my rendering transform, but keying off setRenderingTransform() doesn't seem to work; it seems to be called before the "final" transform is achieved.
What can I wait for to determine when the rendering transform is "done" and ready to be communicated? Maybe computeRenderingTransform? I've tried waiting for the GVT tree to render and for the SVG "onLoad" event, but both seem to be too early and not communicating any change.
Michael
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
