Hi,

> or if you can look at the code below, and tell me where did i go wrong...
> in this code, i tried to follow what is done in
> org.apache.batik.swing.gvt.AbstractZoomInteractor.mouseReleased
> 
> 
>         double x1= my value
>         double y1= my value
>         double x2= my value
>         double y2= my value
> 
>         double xCurrent = x2;
>         double yCurrent = y2;
>         double xStart = x1;
>         double yStart = y1;
> 
>          if ((xCurrent - xStart) != 0 &&
>             (yCurrent - yStart) != 0) {
> 
>             int dx = xCurrent - xStart;
>             int dy = yCurrent - yStart;
> 
>             if (dx < 0) {
>                 dx = -dx;
>                 xStart = xCurrent;
>             }
>             if (dy < 0) {
>                 dy = -dy;
>                 yStart = yCurrent;
>             }
> 
>             Dimension size = c.getSize();
> 
>             // Zoom factor
>             float scaleX = size.width / (float)dx;
>             float scaleY = size.height / (float)dy;
>             float scale = (scaleX < scaleY) ? scaleX : scaleY;
> 
>             // Zoom translate
>             AffineTransform at = new AffineTransform();
>             at.scale(scale, scale);
>             at.translate(-xStart, -yStart);
> 
>             at.concatenate(c.getRenderingTransform());
>             c.setRenderingTransform(at);

Make sure the x2 and y2 is the exact coordinate not the width and height
value.

Regards
Tonny Kohar
-- 
Sketsa 
SVG Graphics Editor
http://www.kiyut.com



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to