Example #1
0
  public void mouseDown(MouseEvent e, int x, int y) {
    super.mouseDown(e, x, y);
    // replace pts by actual event pts
    x = e.getX();
    y = e.getY();

    if (e.getClickCount() >= 2) {
      if (fPolygon != null) {
        fPolygon.smoothPoints();

        // use undo activity from paste command...
        setUndoActivity(createUndoActivity());

        // put created figure into a figure enumeration
        getUndoActivity().setAffectedFigures(new SingleFigureEnumerator(getAddedFigure()));

        editor().toolDone();
      }
      fPolygon = null;

    } else {
      // use original event coordinates to avoid
      // supress that the scribble is constrained to
      // the grid
      addPoint(e.getX(), e.getY());
    }
  }
Example #2
0
 public void deactivate() {
   if (fPolygon != null) {
     fPolygon.smoothPoints();
     if (fPolygon.pointCount() < 3 || fPolygon.size().width < 4 || fPolygon.size().height < 4) {
       getActiveView().drawing().remove(fPolygon);
       // nothing to undo
       setUndoActivity(null);
     }
   }
   fPolygon = null;
   super.deactivate();
 }
Example #3
0
 public void activate() {
   super.activate();
   fPolygon = null;
 }