"Tonny Kohar" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> 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

Tonny:
I appreciate your help.
They are exact coordinates and it is still not working.
In the example i followed, these coordinates are retrieved from the mouse
event evt.getX() and evt.getY(), but in my case, they are absolute
coordinates in the SVG document coordinate system. maybe this is the
problem.
so how do i convert my absolute coordinates into coordinates in the display
component coordinate system?

thanks
hilz




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

Reply via email to