/** Implements the Image/Zoom/View 100% command. */ public void zoom100Percent() { if (magnification == 1.0) return; double imag = imp.getWindow().getInitialMagnification(); if (magnification != imag) unzoom(); if (magnification == 1.0) return; if (magnification < 1.0) { while (magnification < 1.0) zoomIn(imageWidth / 2, imageHeight / 2); } else if (magnification > 1.0) { while (magnification > 1.0) zoomOut(imageWidth / 2, imageHeight / 2); } else return; int x = xMouse, y = yMouse; if (mouseExited) { x = imageWidth / 2; y = imageHeight / 2; } int sx = screenX(x); int sy = screenY(y); adjustSourceRect(1.0, sx, sy); repaint(); }