public void mouseWheelMoved(MouseWheelEvent e) {
		
        int notches = e.getWheelRotation();
        JViewport vp = diagramPane.getViewport();
		
        if (e.isControlDown()) {
			
            if (notches < 0) {
                /*
                 * Zoom in
                 */
				
                Point p1 = vp.getViewPosition();
                p1.x += e.getX();
                double x = (double)p1.x / (double)vp.getViewSize().width;
				
                diagram.zoomIn();
                updatePageInfo();
				
                Point p2 = new Point((int)(x * (double)vp.getViewSize().width), 0);
                if (p2.x > e.getX()) {
                    p2.x -= e.getX();
                }
				
                vp.setViewPosition(p2);
				
            } else {
                /*
                 * Zoom out
                 */
				
                Point p1 = vp.getViewPosition();
                p1.x += e.getX();
                double x = (double)p1.x / (double)vp.getViewSize().width;
				
                diagram.zoomOut();
                updatePageInfo();
				
                if (vp.getViewSize().width < vp.getViewRect().width) {
                    diagram.zoomFit(vp.getViewRect().width);
                }
				
                Point p2 = new Point((int)(x * (double)vp.getViewSize().width), 0);
                if (p2.x > e.getX()) {
                    p2.x -= e.getX();
                }
				
                vp.setViewPosition(p2);
				
            }
			
        } else {
			
            if (notches < 0) {
				
                Point p = vp.getViewPosition();
                if (p.x > 30) {
                    p.x -= 30;
                } else {
                    p.x = 0;
                }
				
                vp.setViewPosition(p);
				
            } else {
				
                Point p = vp.getViewPosition();
                if ((p.x + 30) < (vp.getViewSize().width - vp.getViewRect().width)) {
                    p.x += 30;
                } else {
                    p.x = (vp.getViewSize().width - vp.getViewRect().width);
                }
				
                vp.setViewPosition(p);
				
            }
			
        }
		
    }