code: protected Point limitPointToWorldWindow( Point point ) {
          Rectangle viewport = this.getWwd().getView().getViewport();
  
          int x = point.x;
          if (x < viewport.x)
              x = viewport.x;
          if (x > viewport.x + viewport.width)
              x = viewport.x + viewport.width;
  
          int y = point.y;
          if (y < viewport.y)
              y = viewport.y;
          if (y > viewport.y + viewport.height)
              y = viewport.y + viewport.height;
  
          return new Point(x, y);
      }
docs: Limits the specified point's x and y coordinates to the World Window's
  viewport, and returns a new point with the limited coordinates. For
  example, if the World Window's viewport rectangle is x=0, y=0, width=100,
  height=100 and the point's coordinates are x=50, y=200 this returns a new
  point with coordinates x=50, y=100. If the specified point is already
  inside the World Window's viewport, this returns a new point with the
  same x and y coordinates as the specified point.
  
  @param point
  the point to limit.
  
  @return a new Point representing the specified point limited to the World
  Window's viewport rectangle.