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 onedelacruise <on...@yahoo.com> on 2007/09/06 12:30:58 UTC

questions about zooming and panning

how do i limit zooming and panning? limit meaning if panning, the white empty
space will not be shown and zooming meaning the svg can only be zoomed out
until the whole svg is seen. i read that setRenderingTransform must be
overriden but i looked at the code and i do not know where to start.. and
how can i activate panning/zooming by button and mouseclick? thanks
-- 
View this message in context: http://www.nabble.com/questions-about-zooming-and-panning-tf4391163.html#a12519638
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


Re: questions about zooming and panning

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

onedelacruise <on...@yahoo.com> wrote on 09/06/2007 06:30:58 AM:

> how do i limit zooming and panning? limit meaning if panning, the white 
empty
> space will not be shown and zooming meaning the svg can only be zoomed 
out
> until the whole svg is seen. i read that setRenderingTransform must be
> overriden but i looked at the code and i do not know where to start..

   The Rendering Transform controls what part of the infinite canvas
is visible.  You can calculate what part of the canvas will be shown
for any rendering transform by mapping the corner points of the canvas
(0,0), (canvasWidth,0), ... through the inverse of the 'Viewbox 
transform',
which is the concatenation of the rendering transform and the viewing
transform if any:
        AffineTransform at = getRenderingTransform();
        if (at == null) at = new AffineTransform();
        else            at = new AffineTransform(at);
        AffineTransform vt = getViewingTransform();
        if (vt != null) {
            at.concatenate(vt);
        }

   You will then need to adjust the rendering transform to pull those
points inside your 'active area'.

> and how can i activate panning/zooming by button and mouseclick? thanks

   See the scrollAction/zoomAction classes in JSVGCanvas.


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