List Info

Thread: JSVGCanvas Transform Retention




JSVGCanvas Transform Retention
country flaguser name
United States
2007-10-01 08:47:00
Hi

I am currently trying to work out how I can get the state of
the JSVGCanvas
in my project to be kept when the SVG document is replaced
(eg. how zoomed
in you are on the canvas, how rotated you are, etc.).  So
when a new
document is loaded into the canvas then you see it as if it
has just
replaced the previous document, currently it just resets the
document to the
original position (aligned to the top left of the screen).

Can anyone help me with this?  It seems like it might be
easier said that
done.

Jon
-- 
View this message in context: http://www.nabble.com/JSVGCanvas-Tr
ansform-Retention-tf4548468.html#a12979528
Sent from the Batik - Users mailing list archive at
Nabble.com.


------------------------------------------------------------
---------
To unsubscribe, e-mail: batik-users-unsubscribexmlgraphics.apache.org
For additional commands, e-mail: batik-users-helpxmlgraphics.apache.org


Re: JSVGCanvas Transform Retention
country flaguser name
United States
2007-10-04 07:26:05

Hi Jon,

poozle <jdb25bath.ac.uk> wrote on 10/01/2007 09:47:00 AM:

&gt; I am currently trying to work out how I can get the state of the JSVGCanvas
> in my project to be kept when the SVG document is replaced (eg. how zoomed
> in you are on the canvas, how rotated you are, etc.).  So when a new
> document is loaded into the canvas then you see it as if it has just
>; replaced the previous document, currently it just resets the document to the
> original position (aligned to the top left of the screen).
>
> Can anyone help me with this?  It seems like it might be easier said that
>; done.

   For 'compatible' documents (same viewBox[*]) this is as simple as
copying the Rendering Transform (JSVGCanvas.getRenderingTransform()) before
you load the new document and then set that RenderingTransform (best done
in the SVG on load event).

[*] BTW if the viewBox spec's don't match then it's actually a little hard to
say what it means to keep the same zoom/pan/rotate (you would have to have some
'other' way to 'align' the underlying coordinate system).
Re: JSVGCanvas Transform Retention
country flaguser name
United States
2007-10-04 10:31:25
Thanks Thomas,

That works almost perfectly, I think I must have been
setting it too early
before (before the document was loaded in).  The only
trouble is now it
"bounces" (goes to the origin for a second then to
the right position).

I think I must be setting it in the wrong load event (there
seemed to be too
many of them), which of them should I use as I couldn't work
it out.

Jon



thomas.deweese wrote:
> 
> Hi Jon,
> 
>    For 'compatible' documents (same viewBox[*]) this is
as simple as
> copying the Rendering Transform
(JSVGCanvas.getRenderingTransform()) 
> before 
> you load the new document and then set that
RenderingTransform (best done
> in the SVG on load event).
> 
> [*] BTW if the viewBox spec's don't match then it's
actually a little hard 
> to
> say what it means to keep the same zoom/pan/rotate (you
would have to have 
> some
> 'other' way to 'align' the underlying coordinate
system).
> 

-- 
View this message in context: http://www.nabble.com/JSVGCanvas-Tr
ansform-Retention-tf4548468.html#a13042476
Sent from the Batik - Users mailing list archive at
Nabble.com.


------------------------------------------------------------
---------
To unsubscribe, e-mail: batik-users-unsubscribexmlgraphics.apache.org
For additional commands, e-mail: batik-users-helpxmlgraphics.apache.org


[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )