Logo Search packages:      
Sourcecode: wims version File versions  Download package

double [] edu::hws::jcm::draw::CoordinateRect::zoomInOnPixel ( int  x,
int  y 
) [inline]

Change limits to zoom in by a factor of 2, centered on a specified point. A maximal zoom is enforced. The point does not move. Only valid when CoordinateRect is displayed in a rectangle on the screen.

Parameters:
x the horizontal pixel coordinate of the center point of the zoom
y the vertical pixel coordinate of the center point of the zoom
Returns:
an array of the new limits, or null if limits don't change.

Definition at line 551 of file CoordinateRect.java.

References badData(), getLimits(), pixelToX(), pixelToY(), and setLimits().

                                               {
      if (badData())
         return getLimits();
      double halfwidth = (xmax - xmin)/4.0;
      double halfheight = (ymax - ymin)/4.0;
      if (Math.abs(halfheight) < 1e-100 || Math.abs(halfwidth) < 1e-100)
           return null;
      double xclick = pixelToX(x);
      double yclick = pixelToY(y);
      double centerx = (xmin+xmax)/2;
      double centery = (ymin+ymax)/2;
      double newCenterx = (centerx+xclick)/2;
      double newCentery = (centery+yclick)/2;
      setLimits(newCenterx - halfwidth, newCenterx + halfwidth,
                   newCentery - halfheight, newCentery + halfheight);
      return getLimits();      
   }


Generated by  Doxygen 1.6.0   Back to index