protected void handleMouseDown(int sx, int sy) { if (state==NORMAL && ic!=null) { state = MOVING; startX = ic.offScreenX(sx); startY = ic.offScreenY(sy); startXD = ic.offScreenXD(sx); startYD = ic.offScreenYD(sy); //showStatus(); } }
public int getOffscreenX(MouseEvent e) { ImageCanvas canvas = getImageCanvas(e); return canvas == null ? -1 : canvas.offScreenX(e.getX()); }
@Override public void mouseMoved(MouseEvent e) { if (image == null) return; int x = canvas.offScreenX(e.getX()); int frame = 1 + (int)((peakCountPlotLimits[1] - peakCountPlotLimits[0]) * (x - Plot.LEFT_MARGIN) / (peakCountPlot.getWidth() - Plot.LEFT_MARGIN - Plot.RIGHT_MARGIN)); if (frame >= 1 && frame <= image.getStackSize()) image.setSlice(frame); } });
protected void handleMouseDown(int sx, int sy) { if (state==NORMAL && ic!=null) { state = MOVING; startX = ic.offScreenX(sx); startY = ic.offScreenY(sy); startXD = ic.offScreenXD(sx); startYD = ic.offScreenYD(sy); //showStatus(); } }
public void mouseReleased(ImagePlus imp, MouseEvent e) { ImageCanvas ic = imp.getCanvas(); int sx = e.getX(); int sy = e.getY(); int ox = ic.offScreenX(sx); int oy = ic.offScreenY(sy); Roi roi = imp.getRoi(); if (arrow!=null && !(roi!=null && (roi instanceof Arrow) && roi.contains(ox,oy))) { arrow.mouseReleased(e); e.consume(); } }
protected void mouseDownInHandle(int handle, int sx, int sy) { if (state==CONSTRUCTING) return; int ox=ic.offScreenX(sx), oy=ic.offScreenY(sy); double oxd=ic.offScreenXD(sx), oyd=ic.offScreenYD(sy); if ((IJ.altKeyDown()||IJ.controlKeyDown()) && !(nPoints<=3 && type!=POINT) && !(this instanceof RotatedRectRoi)) { deleteHandle(oxd, oyd); return; } else if (IJ.shiftKeyDown() && type!=POINT && !(this instanceof RotatedRectRoi)) { addHandle(oxd, oyd); return; } state = MOVING_HANDLE; activeHandle = handle; int m = (int)(10.0/ic.getMagnification()); xClipMin=ox-m; yClipMin=oy-m; xClipMax=ox+m; yClipMax=oy+m; }
public void mouseReleased(ImagePlus imp, MouseEvent e) { ImageCanvas ic = imp.getCanvas(); int sx = e.getX(); int sy = e.getY(); int ox = ic.offScreenX(sx); int oy = ic.offScreenY(sy); Roi roi = imp.getRoi(); if (arrow!=null && !(roi!=null && (roi instanceof Arrow) && roi.contains(ox,oy))) { arrow.mouseReleased(e); e.consume(); } }
protected void mouseDownInHandle(int handle, int sx, int sy) { if (state==CONSTRUCTING) return; int ox=ic.offScreenX(sx), oy=ic.offScreenY(sy); double oxd=ic.offScreenXD(sx), oyd=ic.offScreenYD(sy); if ((IJ.altKeyDown()||IJ.controlKeyDown()) && !(nPoints<=3 && type!=POINT) && !(this instanceof RotatedRectRoi)) { deleteHandle(oxd, oyd); return; } else if (IJ.shiftKeyDown() && type!=POINT && !(this instanceof RotatedRectRoi)) { addHandle(oxd, oyd); return; } state = MOVING_HANDLE; activeHandle = handle; int m = (int)(10.0/ic.getMagnification()); xClipMin=ox-m; yClipMin=oy-m; xClipMax=ox+m; yClipMax=oy+m; }
public void mouseDragged(ImagePlus imp, MouseEvent e) { ImageCanvas ic = imp.getCanvas(); int sx = e.getX(); int sy = e.getY(); int ox = ic.offScreenX(sx); int oy = ic.offScreenY(sy); Roi roi = imp.getRoi(); if (roi!=null && (roi instanceof Arrow) && roi.contains(ox,oy)) roi.mouseDragged(e); else if (arrow!=null) arrow.mouseDragged(e); e.consume(); }
public void mouseDragged(ImagePlus imp, MouseEvent e) { ImageCanvas ic = imp.getCanvas(); int sx = e.getX(); int sy = e.getY(); int ox = ic.offScreenX(sx); int oy = ic.offScreenY(sy); Roi roi = imp.getRoi(); if (roi!=null && (roi instanceof Arrow) && roi.contains(ox,oy)) roi.mouseDragged(e); else if (arrow!=null) arrow.mouseDragged(e); e.consume(); }
public void mousePressed(ImagePlus imp, MouseEvent e) { ImageCanvas ic = imp.getCanvas(); int sx = e.getX(); int sy = e.getY(); int ox = ic.offScreenX(sx); int oy = ic.offScreenY(sy); Roi roi = imp.getRoi(); int handle = roi!=null?roi.isHandle(ox, oy):-1; if (!(roi!=null && (roi instanceof Arrow) && (handle>=0||roi.contains(ox,oy)))) { arrow = new Arrow(sx, sy, imp); imp.setRoi(arrow, false); e.consume(); } }
public void mousePressed(ImagePlus imp, MouseEvent e) { ImageCanvas ic = imp.getCanvas(); int sx = e.getX(); int sy = e.getY(); int ox = ic.offScreenX(sx); int oy = ic.offScreenY(sy); Roi roi = imp.getRoi(); int handle = roi!=null?roi.isHandle(ox, oy):-1; if (!(roi!=null && (roi instanceof Arrow) && (handle>=0||roi.contains(ox,oy)))) { arrow = new Arrow(sx, sy, imp); imp.setRoi(arrow, false); e.consume(); } }
void move(int sx, int sy) { int xNew = ic.offScreenX(sx); int yNew = ic.offScreenY(sy); x += xNew - startxd; y += yNew - startyd; clipboard=null; startxd = xNew; startyd = yNew; updateClipRect(); if (ignoreClipRect) imp.draw(); else imp.draw(clipX, clipY, clipWidth, clipHeight); oldX = x; oldY = y; oldWidth = width; oldHeight=height; }
/** * Method mouse moved, show the coordinates of the mouse pointer. * * @param e mouse event */ public void mouseMoved (final MouseEvent e) { setControl(); final int x = mainImp.getWindow().getCanvas().offScreenX(e.getX()); final int y = mainImp.getWindow().getCanvas().offScreenY(e.getY()); IJ.showStatus(mainImp.getLocationAsString(x, y) + getValueAsString(x, y)); } /* end mouseMoved */
void moveRoi(int sx, int sy){ xNew = ic.offScreenX(sx); yNew = ic.offScreenY(sy); dx1 = xNew - startX; dy1 = yNew - startY; if (dx1==0 && dy2==0) return; startX = xNew; startY = yNew; dx = roi.getXBase() + dx1; dy = roi.getYBase() + dy1; roi.setLocation(dx, dy); imp2.draw(); }
void move(int sx, int sy) { int xNew = ic.offScreenX(sx); int yNew = ic.offScreenY(sy); x += xNew - startxd; y += yNew - startyd; clipboard=null; startxd = xNew; startyd = yNew; updateClipRect(); if (ignoreClipRect) imp.draw(); else imp.draw(clipX, clipY, clipWidth, clipHeight); oldX = x; oldY = y; oldWidth = width; oldHeight=height; }
void moveRoi(int sx, int sy){ xNew = ic.offScreenX(sx); yNew = ic.offScreenY(sy); dx1 = xNew - startX; dy1 = yNew - startY; if (dx1==0 && dy2==0) return; startX = xNew; startY = yNew; dx = roi.getXBase() + dx1; dy = roi.getYBase() + dy1; roi.setLocation(dx, dy); imp2.draw(); }
public void mouseMoved(MouseEvent e) { int x = canvas.offScreenX(e.getX()); int y = canvas.offScreenY(e.getY()); original.setSlice(y + 1); PolygonRoi roi = rois[y]; if (roi == null) { original.setOverlay(null); original.killRoi(); return; } FloatPolygon polygon = roi.getFloatPolygon(); if (polygon.npoints <= x) return; int x2 = (int)polygon.xpoints[x]; int y2 = (int)polygon.ypoints[x]; original.setOverlay(new Overlay(new PointRoi(x2, y2))); original.setRoi(roi); }
protected void handleMouseUp(int screenX, int screenY) { super.handleMouseUp(screenX, screenY); if (width<5 && height<5 && imp!=null && previousRoi==null) { int ox = ic!=null?ic.offScreenX(screenX):screenX; int oy = ic!=null?ic.offScreenY(screenY):screenY; TextRoi roi = new TextRoi(ox, oy, line1a); roi.setStrokeColor(Toolbar.getForegroundColor()); roi.firstChar = true; imp.setRoi(roi); return; } else if (firstMouseUp) { updateBounds(null); updateText(); firstMouseUp = false; } if (width<5 || height<5) imp.deleteRoi(); }
protected void handleMouseUp(int screenX, int screenY) { super.handleMouseUp(screenX, screenY); if (width<5 && height<5 && imp!=null && previousRoi==null) { int ox = ic!=null?ic.offScreenX(screenX):screenX; int oy = ic!=null?ic.offScreenY(screenY):screenY; TextRoi roi = new TextRoi(ox, oy, line1a); roi.setStrokeColor(Toolbar.getForegroundColor()); roi.firstChar = true; imp.setRoi(roi); return; } else if (firstMouseUp) { updateBounds(null); updateText(); firstMouseUp = false; } if (width<5 || height<5) imp.deleteRoi(); }