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

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

Change limits to zoom out by a factor of 2, centered on a specified point. A maximal zoom is enforced. The point (x,y) does not move. Valid only if CoordinateRect has been drawn.

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

Definition at line 578 of file CoordinateRect.java.

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

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

Generated by  Doxygen 1.6.0   Back to index