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 Manuel Brnjic <ma...@gmail.com> on 2008/02/06 16:12:57 UTC
Zooming out to last Zoomedin-Status
Hello,
I am zooming into a choosen Rect in a SVG-Map:
// Zoom translate
AffineTransform at = new AffineTransform();
at.scale(scale, scale);
at.translate(-xStart, -yStart);
at.concatenate(svgCanvas.getRenderingTransform());
svgCanvas.setRenderingTransform(at);
So now if i zoom a few times in, i want to zoom out. I want to zoom out back
to the last zoomed-in status. I tried it like this:
//width & height of the last choosen rect (choosen area for zooming in)
int dx = releasedX - pressedX;
int dy = releasedY - pressedY;
//Zoom-out
AffineTransform at = new AffineTransform();
at.translate(pressedX+dx/2, pressedY+dy/2);
at.scale(zoomScale.getLast(), zoomScale.getLast()); //zoomScale is a
LinkedList where the Scalings of the last zoom-in actions are being saved
at.translate(-pressedX-dx/2, -pressedY-dy/2);
svgCanvas.setRenderingTransform(at);
//removing the last zoomScale
zoomTimes.removeLast();
So my problem is: when i zoom in, it works very well.
But when i try to zoomout (back to the last zoomed-in status), it doesent
zoomes me exactly to that area back!
It's zooming a little bit to much down and to the left side
instead of the exact choosen area from the last zoomed-in status.
Can anybody help me? Has anyone coded something like that? Maybe i can use
some code samples from yours..
greetings, Manuel