protected double checkScaleAgainstLimits(){
  Point2D p1=getUpperLeft();
  Point2D p2=getLowerRight();
  double x=p1.getX();
  double y=p1.getY();
  if (topLimit != Double.POSITIVE_INFINITY) {
    y=topLimit;
  }
  if (leftLimit != Double.NEGATIVE_INFINITY) {
    x=leftLimit;
  }
  p1.setLocation(x,y);
  x=p2.getX();
  y=p2.getY();
  if (bottomLimit != Double.NEGATIVE_INFINITY) {
    y=bottomLimit;
  }
  if (rightLimit != Double.POSITIVE_INFINITY) {
    x=rightLimit;
  }
  p2.setLocation(x,y);
  return getScale(p1,p2,p1,p2);
}

protected double checkScaleAgainstLimits ( ) { Point2D p1 = getUpperLeft ( ) ; Point2D p2 = getLowerRight ( ) ; double x = p1 . getX ( ) ; double y = p1 . getY ( ) ; if ( topLimit != Double . POSITIVE_INFINITY ) { y = topLimit ; } if ( leftLimit != Double . NEGATIVE_INFINITY ) { x = leftLimit ; } p1 . setLocation ( x , y ) ; x = p2 . getX ( ) ; y = p2 . getY ( ) ; if ( bottomLimit != Double . NEGATIVE_INFINITY ) { y = bottomLimit ; } if ( rightLimit != Double . POSITIVE_INFINITY ) { x = rightLimit ; } p2 . setLocation ( x , y ) ; return getScale ( p1 , p2 , p1 , p2 ) ; }
checks the corner values against the limits and returns the right scale to keep limits at the edge if necessary .
