(MouseEvent e)
| 1638 | } |
| 1639 | |
| 1640 | @AstroImageJ(reason = "Update x/yClicked", modified = true) |
| 1641 | public void mouseReleased(MouseEvent e) { |
| 1642 | xClicked = e.getX(); |
| 1643 | yClicked = e.getY(); |
| 1644 | |
| 1645 | if (pressTimer!=null) { |
| 1646 | pressTimer.cancel(); |
| 1647 | pressTimer = null; |
| 1648 | } |
| 1649 | |
| 1650 | int ox = offScreenX(e.getX()); |
| 1651 | int oy = offScreenY(e.getY()); |
| 1652 | Overlay overlay = imp.getOverlay(); |
| 1653 | if ((overlay!=null||showAllOverlay!=null) && ox==mousePressedX && oy==mousePressedY) { |
| 1654 | boolean cmdDown = IJ.isMacOSX() && e.isMetaDown(); |
| 1655 | Roi roi = imp.getRoi(); |
| 1656 | if (roi!=null && roi.getBounds().width==0) |
| 1657 | roi=null; |
| 1658 | if ((e.isAltDown()||e.isControlDown()||cmdDown) && roi==null) { |
| 1659 | if (activateOverlayRoi(ox, oy)) |
| 1660 | return; |
| 1661 | } else if ((System.currentTimeMillis()-mousePressedTime)>250L && !drawingTool()) { // long press |
| 1662 | if (activateOverlayRoi(ox,oy)) |
| 1663 | return; |
| 1664 | } |
| 1665 | |
| 1666 | } |
| 1667 | |
| 1668 | PlugInTool tool = Toolbar.getPlugInTool(); |
| 1669 | if (tool!=null) { |
| 1670 | tool.mouseReleased(imp, e); |
| 1671 | if (e.isConsumed()) return; |
| 1672 | } |
| 1673 | flags = e.getModifiers(); |
| 1674 | flags &= ~InputEvent.BUTTON1_MASK; // make sure button 1 bit is not set |
| 1675 | flags &= ~InputEvent.BUTTON2_MASK; // make sure button 2 bit is not set |
| 1676 | flags &= ~InputEvent.BUTTON3_MASK; // make sure button 3 bit is not set |
| 1677 | Roi roi = imp.getRoi(); |
| 1678 | if (roi != null) { |
| 1679 | Rectangle r = roi.getBounds(); |
| 1680 | int type = roi.getType(); |
| 1681 | if ((r.width==0 || r.height==0) |
| 1682 | && !(type==Roi.POLYGON||type==Roi.POLYLINE||type==Roi.ANGLE||type==Roi.LINE) |
| 1683 | && !(roi instanceof TextRoi) |
| 1684 | && roi.getState()==roi.CONSTRUCTING |
| 1685 | && type!=roi.POINT) |
| 1686 | imp.deleteRoi(); |
| 1687 | else |
| 1688 | roi.handleMouseUp(e.getX(), e.getY()); |
| 1689 | } |
| 1690 | } |
| 1691 | |
| 1692 | private boolean activateOverlayRoi(int ox, int oy) { |
| 1693 | int currentImage = -1; |
no test coverage detected