/** Displays the cursor coordinates and pixel value in the status bar. Called by ImageCanvas when the mouse moves. Can be overridden by ImagePlus subclasses. */ public void mouseMoved(int x, int y) { Roi roi2 = getRoi(); if (ij!=null && (roi2==null || roi2.getState()==Roi.NORMAL)) ij.showStatus(getLocationAsString(x,y) + getValueAsString(x,y)); savex=x; savey=y; }
/** Displays the cursor coordinates and pixel value in the status bar. Called by ImageCanvas when the mouse moves. Can be overridden by ImagePlus subclasses. */ public void mouseMoved(int x, int y) { Roi roi2 = getRoi(); if (ij!=null && (roi2==null || roi2.getState()==Roi.NORMAL)) ij.showStatus(getLocationAsString(x,y) + getValueAsString(x,y)); savex=x; savey=y; }
if (! (roi != null && roi instanceof PolygonRoi && roi.getState() == Roi.CONSTRUCTING) ) drawSyncCursor(imp, p.x, p.y); if(iw != iwc)
protected void handlePopupMenu(MouseEvent e) { if (disablePopupMenu) return; if (IJ.debugMode) IJ.log("show popup: " + (e.isPopupTrigger()?"true":"false")); int x = e.getX(); int y = e.getY(); Roi roi = imp.getRoi(); if (roi!=null && (roi.getType()==Roi.POLYGON || roi.getType()==Roi.POLYLINE || roi.getType()==Roi.ANGLE) && roi.getState()==roi.CONSTRUCTING) { roi.handleMouseUp(x, y); // simulate double-click to finalize roi.handleMouseUp(x, y); // polygon or polyline selection return; } PopupMenu popup = Menus.getPopupMenu(); if (popup!=null) { add(popup); if (IJ.isMacOSX()) IJ.wait(10); popup.show(this, x, y); } }
if (! (roi != null && roi instanceof PolygonRoi && roi.getState() == Roi.CONSTRUCTING) ) drawSyncCursor(imp, p.x, p.y); if(iw != iwc)
protected void handlePopupMenu(MouseEvent e) { if (disablePopupMenu) return; if (IJ.debugMode) IJ.log("show popup: " + (e.isPopupTrigger()?"true":"false")); int x = e.getX(); int y = e.getY(); Roi roi = imp.getRoi(); if (roi!=null && (roi.getType()==Roi.POLYGON || roi.getType()==Roi.POLYLINE || roi.getType()==Roi.ANGLE) && roi.getState()==roi.CONSTRUCTING) { roi.handleMouseUp(x, y); // simulate double-click to finalize roi.handleMouseUp(x, y); // polygon or polyline selection return; } PopupMenu popup = Menus.getPopupMenu(); if (popup!=null) { add(popup); if (IJ.isMacOSX()) IJ.wait(10); popup.show(this, x, y); } }
if (! (roi != null && roi instanceof PolygonRoi && roi.getState() == Roi.CONSTRUCTING) ) drawSyncCursor(imp, p.x, p.y);
@Override public void mouseMoved(final MouseEvent e) { super.mouseMoved(e); adaptChannelMouse(); // To avoid ROI flickering, only adapt ROI when it really has changed. // Code copied from ImageCanvas.mouseMoved(). final Roi roi = imp.getRoi(); if (roi != null && (roi.getType() == Roi.POLYGON || roi.getType() == Roi.POLYLINE || roi .getType() == Roi.ANGLE) && roi.getState() == Roi.CONSTRUCTING) { adaptChannelRois(true); } }
else setCursor(crosshairCursor); } else if (roi!=null && roi.getState()!=roi.CONSTRUCTING && roi.isHandle(sx, sy)>=0) { setCursor(handCursor); } else if ((overlay!=null||showAllOverlay!=null) && overOverlayLabel(sx,sy,ox,oy) && (roi==null||roi.getState()!=roi.CONSTRUCTING)) { overOverlayLabel = true; setCursor(handCursor); } else if (Prefs.usePointerCursor || (roi!=null && roi.getState()!=roi.CONSTRUCTING && roi.contains(ox, oy))) setCursor(defaultCursor); else
int type = roi!=null?roi.getType():-1; if (type>0 && (type==Roi.POLYGON||type==Roi.POLYLINE||type==Roi.ANGLE||type==Roi.LINE) && roi.getState()==roi.CONSTRUCTING) roi.mouseMoved(e); else {
&& !(type==Roi.POLYGON||type==Roi.POLYLINE||type==Roi.ANGLE||type==Roi.LINE) && !(roi instanceof TextRoi) && roi.getState()==roi.CONSTRUCTING && type!=roi.POINT) imp.deleteRoi();
else setCursor(crosshairCursor); } else if (roi!=null && roi.getState()!=roi.CONSTRUCTING && roi.isHandle(sx, sy)>=0) { setCursor(handCursor); } else if ((overlay!=null||showAllOverlay!=null) && overOverlayLabel(sx,sy,ox,oy) && (roi==null||roi.getState()!=roi.CONSTRUCTING)) { overOverlayLabel = true; setCursor(handCursor); } else if (Prefs.usePointerCursor || (roi!=null && roi.getState()!=roi.CONSTRUCTING && roi.contains(ox, oy))) setCursor(defaultCursor); else
int type = roi!=null?roi.getType():-1; if (type>0 && (type==Roi.POLYGON||type==Roi.POLYLINE||type==Roi.ANGLE||type==Roi.LINE) && roi.getState()==roi.CONSTRUCTING) roi.mouseMoved(e); else {
&& !(type==Roi.POLYGON||type==Roi.POLYLINE||type==Roi.ANGLE||type==Roi.LINE) && !(roi instanceof TextRoi) && roi.getState()==roi.CONSTRUCTING && type!=roi.POINT) imp.deleteRoi();
if (altDown && !IJ.macroRunning()) IJ.setKeyDown(KeyEvent.VK_SHIFT); if (roi.getState()==Roi.CONSTRUCTING) { //wait (up to 2 sec.) until ROI finished long start = System.currentTimeMillis(); while (true) { IJ.wait(10); if (roi.getState()!=Roi.CONSTRUCTING) break; if ((System.currentTimeMillis()-start)>2000) {
if (altDown && !IJ.macroRunning()) IJ.setKeyDown(KeyEvent.VK_SHIFT); if (roi.getState()==Roi.CONSTRUCTING) { //wait (up to 2 sec.) until ROI finished long start = System.currentTimeMillis(); while (true) { IJ.wait(10); if (roi.getState()!=Roi.CONSTRUCTING) break; if ((System.currentTimeMillis()-start)>2000) {
/** Converts the current cursor location to a string. */ public String getLocationAsString(int x, int y) { Calibration cal = getCalibration(); if (getProperty("FHT")!=null) return getFFTLocation(x, height-y, cal); String xx="", yy=""; if (cal.scaled()) { xx = " ("+x+")"; yy = " ("+y+")"; } String s = " x="+d2s(cal.getX(x)) + xx + ", y=" + d2s(cal.getY(y,height)) + yy; if (getStackSize()>1) { Roi roi2 = getRoi(); if (roi2==null || roi2.getState()==Roi.NORMAL) { int z = isDisplayedHyperStack()?getSlice()-1:getCurrentSlice()-1; String zz = cal.scaled()&&cal.getZ(z)!=z?" ("+z+")":""; s += ", z="+d2s(cal.getZ(z))+zz; } } return s; }
/** Converts the current cursor location to a string. */ public String getLocationAsString(int x, int y) { Calibration cal = getCalibration(); if (getProperty("FHT")!=null) return getFFTLocation(x, height-y, cal); String xx="", yy=""; if (cal.scaled()) { xx = " ("+x+")"; yy = " ("+y+")"; } String s = " x="+d2s(cal.getX(x)) + xx + ", y=" + d2s(cal.getY(y,height)) + yy; if (getStackSize()>1) { Roi roi2 = getRoi(); if (roi2==null || roi2.getState()==Roi.NORMAL) { int z = isDisplayedHyperStack()?getSlice()-1:getCurrentSlice()-1; String zz = cal.scaled()&&cal.getZ(z)!=z?" ("+z+")":""; s += ", z="+d2s(cal.getZ(z))+zz; } } return s; }
if ((newRoi instanceof Arrow) && newRoi.getState()==Roi.CONSTRUCTING && bounds.width==0 && bounds.height==0) { deleteRoi(); roi = newRoi;