You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by Shekhar Bhati <sh...@gmail.com> on 2009/10/14 12:57:26 UTC

Issue in restoring zoom/pan factor

Hi Batik users,

I am using Batik for viewing the images in my application.
We have a functionality of drag and drop of the objects and when I
drop the object , document gets reloaded.
If first i zoom the image and then do the drag and drop  then the
document gets reloaded and the image is not zoomed in after reloading.
My task is to restore the scale/factor and coordinates after
reloading, so that view gets open on the same place and with same
zoomed/panned state as it was before dropping.
Any hints??

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


Re: Issue in restoring zoom/pan factor

Posted by th...@kodak.com.
Hi Bhati,

Shekhar Bhati <sh...@gmail.com> wrote on 10/14/2009 06:57:26 AM:

> I am using Batik for viewing the images in my application.
> We have a functionality of drag and drop of the objects and when I
> drop the object , document gets reloaded.

   Why do you reload the document?  If you setup the canvas so it
is dynamic and changes to the document[*] will be reflected automatically
in the canvas.

> If first i zoom the image and then do the drag and drop  then the
> document gets reloaded and the image is not zoomed in after reloading.
> My task is to restore the scale/factor and coordinates after
> reloading, so that view gets open on the same place and with same
> zoomed/panned state as it was before dropping.
> Any hints??

    The zoom/pan information is stored in the rendering transform.
The canvas has a 'getRenderingTransform()' method to get this.  You 
can also set it with 'setRenderingTransfom()' the one tricky thing
is that you need to wait for the document to be loaded before you
set the rendering transform or else it will get reset by the loading
process.