Exemplo n.º 1
0
  /** Handles mouse down events and starts the corresponding tracker. */
  public void mouseDown(MouseEvent e, int x, int y) {
    // on MS-Windows NT: AWT generates additional mouse down events
    // when the left button is down && right button is clicked.
    // To avoid dead locks we ignore such events
    if (fChild != null) {
      return;
    }

    view().freezeView();

    Handle handle = view().findHandle(e.getX(), e.getY());
    if (handle != null) {
      fChild = createHandleTracker(view(), handle);
    } else {
      Figure figure = drawing().findFigure(e.getX(), e.getY());
      if (figure != null) {
        fChild = createDragTracker(figure);
      } else {
        if (!e.isShiftDown()) {
          view().clearSelection();
        }
        fChild = createAreaTracker();
      }
    }
    fChild.mouseDown(e, x, y);
    fChild.activate();
  }