fastDrawing = false;
public void mouseDragged(MouseEvent e) {	ViewState view = ViewState.getInstance();	int px = e.getX()-view.getX0();	int py = e.getY()-view.getY0();	if ((px>0) && (py>0) && (px<width) && (py<height)) {		switch (mouseOperation) {			case NAVIGATOR_MOVE : //System.out.println("Dragged: NAVIGATOR_MOVE");				if (navigator.contains(e.getX(), e.getY()))	{					int dx = (int)((px-pressedX)/navigatorView.getScale()*view.getScale()); 					int dy = (int)((py-pressedY)/navigatorView.getScale()*view.getScale());					if (view.moveOrigin(dx, dy)) {						recalculateNavigatorPosition();						repaint();						pressedX=px; pressedY=py;					}				}				break;			case ORIGIN_MOVE : {//System.out.println("Dragged: ORIGIN_MOVE");				int dx = px-pressedX;				int dy = py-pressedY;				if (view.moveOrigin(dx, dy)) {					recalculateNavigatorPosition();					blockNavigatorRedrawOnce = true;					repaint();					pressedX=px; pressedY=py;				}				break; }						case OBJECT_MOVE : {//System.out.println("Dragged: OBJECT_MOVE");				int rdx = px-draggedX;				int rdy = py-draggedY;								int dx = (int)(rdx/view.getScale()); 				int dy = (int)(rdy/view.getScale());				Movable hilitedObject = (Movable)view.getHilitedObject();								if (view.isSelected(hilitedObject)) {					if (moveSelection(dx, dy)) {			// move selection						blockNavigatorRedrawOnce = true;	/// !!! performance						repaint();						if (dx!=0) draggedX=px-(int)(rdx-dx*view.getScale());						if (dy!=0) draggedY=py-(int)(rdy-dy*view.getScale());					}				}				else if (hilitedObject.move(dx, dy)) {					alsoDrawHilitedOnce = true;					blockNavigatorRedrawOnce = true;	/// !!! performance					repaint();					if (dx!=0) draggedX=px-(int)(rdx-dx*view.getScale());					if (dy!=0) draggedY=py-(int)(rdy-dy*view.getScale());				}				break; }							case OBJECT_SELECTION : 			case ZOOM_SELECTION : //System.out.println("Dragged: OBJECT_SELECTION/ZOOM_SELECTION"); 			    draggedX=px; draggedY=py; 			    repaint();			    break;		    			case LINK_OPERATION ://System.out.println("Dragged: LINK_OPERATION"); 			    draggedX=px; draggedY=py;				break;				}		}	// panning	else if ((mouseOperation==OBJECT_MOVE) ||			 (mouseOperation==OBJECT_SELECTION) ||			 (mouseOperation==ZOOM_SELECTION))	{		int dx = 0;		int dy = 0;				if (px<0) 			dx = -view.getGridSize();		else if (px>width) 			dx = view.getGridSize();				if (py<0)			dy = -view.getGridSize();		else if (py>height)			dy = view.getGridSize();				if (view.moveOrigin(dx, dy))		{			if (mouseOperation==OBJECT_MOVE)			{				int mdx = (int)(dx/view.getScale()); 				int mdy = (int)(dy/view.getScale());								Movable hilitedObject = (Movable)view.getHilitedObject();				if (view.isSelected(hilitedObject))				{					moveSelection(mdx, mdy);				}				else				{					hilitedObject.move(mdx, mdy);					alsoDrawHilitedOnce=true;				}				pressedX+=dx; pressedY+=dy;			}			else /*if ((mouseOperation==OBJECT_SELECTION) ||					(mouseOperation==ZOOM_SELECTION))*/			{				pressedX-=dx; pressedY-=dy;				forceRedraw=true;							}						recalculateNavigatorPosition();			repaint();		}	}}