public void mouseWheelMoved(MouseWheelEvent event) { int zoom = event.getWheelRotation(); mx = event.getX(); my = event.getY(); showStatus("Mouse rotated (" + zoom + ")"); // zoom out if (zoom >= 0) { dbg.setColor(Color.black); // dbg.drawImage (background, SIZE/2-current_size/2, // SIZE/2-current_size/2, current_size, current_size, this); } // zoom in else if (zoom < 0) { int width = building.getWidth(this); int height = building.getHeight(this); dbg.drawImage( building, width, height, width / 2, height / 2, width, height, width, height, this); } repaint(); event.consume(); }
public void mouseWheelMoved(MouseWheelEvent e) { int notches = e.getWheelRotation(); if ((zoomScale -= 0.05f * notches) < 0.09999f) zoomScale = 0.1f; repaint(); }