コード例 #1
0
ファイル: PolygonTool.java プロジェクト: samskivert/jhotdraw6
 public void mouseMove(MouseEvent e, int x, int y) {
   if (e.getSource() == getActiveView()) {
     if (fPolygon != null) {
       if (fPolygon.pointCount() > 1) {
         fPolygon.setPointAt(new Point(x, y), fPolygon.pointCount() - 1);
         getActiveView().checkDamage();
       }
     }
   }
 }
コード例 #2
0
ファイル: PolygonTool.java プロジェクト: samskivert/jhotdraw6
 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();
 }