Esempio n. 1
0
 public void mouseReleased(MouseEvent e) {
   flags = e.getModifiers();
   flags &= ~InputEvent.BUTTON1_MASK; // make sure button 1 bit is not set
   flags &= ~InputEvent.BUTTON2_MASK; // make sure button 2 bit is not set
   flags &= ~InputEvent.BUTTON3_MASK; // make sure button 3 bit is not set
   Roi roi = imp.getRoi();
   if (roi != null) {
     Rectangle r = roi.getBounds();
     int type = roi.getType();
     if ((r.width == 0 || r.height == 0)
         && !(type == Roi.POLYGON || type == Roi.POLYLINE || type == Roi.ANGLE || type == Roi.LINE)
         && !(roi instanceof TextRoi)
         && roi.getState() == roi.CONSTRUCTING
         && type != roi.POINT) imp.killRoi();
     else {
       roi.handleMouseUp(e.getX(), e.getY());
       if (roi.getType() == Roi.LINE && roi.getLength() == 0.0) imp.killRoi();
     }
   }
 }