/** Zooms out by modifying the plot range; sx and sy are screen coordinates */ public void zoomOut(int sx, int sy) { zoom(sx, sy, Math.sqrt(0.5)); }
/** Zooms in by modifying the plot range; sx and sy are screen coordinates */ public void zoomIn(int sx, int sy) { zoom(sx, sy, Math.sqrt(2)); }
/** Zooms out by modifying the plot range; sx and sy are screen coordinates */ public void zoomOut(int sx, int sy) { zoom(sx, sy, Math.sqrt(0.5)); }
/** Zooms in by modifying the plot range; sx and sy are screen coordinates */ public void zoomIn(int sx, int sy) { zoom(sx, sy, Math.sqrt(2)); }
/** Mouse wheel: zooms when shift or ctrl is pressed, scrolls in x if space bar down, in y otherwise. */ public synchronized void mouseWheelMoved(MouseWheelEvent e) { if (plot.isFrozen() || !(ic instanceof PlotCanvas)) { //frozen plots are like normal images super.mouseWheelMoved(e); return; } int rotation = e.getWheelRotation(); int amount = e.getScrollAmount(); if (e.getX() < plot.leftMargin || e.getX() > plot.leftMargin + plot.frameWidth)//n__ return; if (e.getY() < plot.topMargin || e.getY() > plot.topMargin + plot.frameHeight) return; boolean ctrl = (e.getModifiers()&Event.CTRL_MASK)!=0; if (amount<1) amount=1; if (rotation==0) return; if (ctrl||IJ.shiftKeyDown()) { double zoomFactor = rotation<0 ? Math.pow(2, 0.2) : Math.pow(0.5, 0.2); Point loc = ic.getCursorLoc(); int x = ic.screenX(loc.x); int y = ic.screenY(loc.y); ((PlotCanvas)ic).zoom(x, y, zoomFactor); } else if (IJ.spaceBarDown()) plot.scroll(rotation*amount*Math.max(ic.imageWidth/50, 1), 0); else plot.scroll(0, rotation*amount*Math.max(ic.imageHeight/50, 1)); }
/** Mouse wheel: zooms when shift or ctrl is pressed, scrolls in x if space bar down, in y otherwise. */ public synchronized void mouseWheelMoved(MouseWheelEvent e) { if (plot.isFrozen() || !(ic instanceof PlotCanvas)) { //frozen plots are like normal images super.mouseWheelMoved(e); return; } int rotation = e.getWheelRotation(); int amount = e.getScrollAmount(); if (e.getX() < plot.leftMargin || e.getX() > plot.leftMargin + plot.frameWidth)//n__ return; if (e.getY() < plot.topMargin || e.getY() > plot.topMargin + plot.frameHeight) return; boolean ctrl = (e.getModifiers()&Event.CTRL_MASK)!=0; if (amount<1) amount=1; if (rotation==0) return; if (ctrl||IJ.shiftKeyDown()) { double zoomFactor = rotation<0 ? Math.pow(2, 0.2) : Math.pow(0.5, 0.2); Point loc = ic.getCursorLoc(); int x = ic.screenX(loc.x); int y = ic.screenY(loc.y); ((PlotCanvas)ic).zoom(x, y, zoomFactor); } else if (IJ.spaceBarDown()) plot.scroll(rotation*amount*Math.max(ic.imageWidth/50, 1), 0); else plot.scroll(0, rotation*amount*Math.max(ic.imageHeight/50, 1)); }
if (ic==null) return; if (ic instanceof PlotCanvas && !((PlotCanvas)ic).isFrozen()) { ((PlotCanvas)ic).zoom(arg); return;
if (ic==null) return; if (ic instanceof PlotCanvas && !((PlotCanvas)ic).isFrozen()) { ((PlotCanvas)ic).zoom(arg); return;