if((startX+(x-offsetX))/lensModel.getImageZoomFactor()+lensModel.getWidth() > lensModel.getImageWidth())
double v = (startX+(x-offsetX))/lensModel.getImageZoomFactor()+ lensModel.getWidth(); if (v > lensModel.getImageWidth())
	void lensMouseDrag(int x, int y, boolean isShiftDown)	{		if (borderDrag)		{			int deltaX = 0;			int deltaY = 0;			int deltaW = 0;			int deltaH = 0;						switch(resizeDir)			{				case LensUI.NORTH:					if (y-offsetY < 0)					{						deltaY = (y-offsetY);						deltaH = Math.abs(y-offsetY);						if(checkBounds(deltaX, deltaY, deltaW, deltaH))							startY = startY+(y-offsetY);					}					else					{						deltaY = (y-offsetY);						deltaH = -Math.abs(y-offsetY);						if(checkBounds(deltaX, deltaY, deltaW, deltaH))							startY = startY+(y-offsetY);					}				break;				case LensUI.SOUTH:					if (y-offsetY > 0)					{						deltaH = Math.abs(y-offsetY);						if(checkBounds(deltaX, deltaY, deltaW, deltaH))							offsetY = y;					}					else					{						deltaH = -Math.abs(y-offsetY);						if(checkBounds(deltaX, deltaY, deltaW, deltaH))							offsetY = y;					}				break;						case LensUI.EAST:					if (x-offsetX > 0)					{						deltaW = Math.abs(x-offsetX);						if(checkBounds(deltaX, deltaY, deltaW, deltaH))							offsetX = x;					}					else					{						deltaW = -Math.abs(x-offsetX);						if(checkBounds(deltaX, deltaY, deltaW, deltaH))							offsetX = x;					}				break;						case LensUI.WEST:					if (x-offsetX > 0)					{						deltaX = (x-offsetX);						deltaW = -Math.abs(x-offsetX);						if(checkBounds(deltaX, deltaY, deltaW, deltaH))							startX = startX+(x-offsetX);					}					else					{						deltaX = -Math.abs(x-offsetX);						deltaW = Math.abs(x-offsetX);						if(checkBounds(deltaX, deltaY, deltaW, deltaH))							startX = startX+(x-offsetX);					}				break;						case LensUI.NORTH_EAST:					if(y-offsetY < 0)					{						deltaY = (y-offsetY);						deltaH = Math.abs(y-offsetY);						if(checkBounds(deltaX, deltaY, deltaW, deltaH))							startY = startY+(y-offsetY);					}					else					{						deltaY = (y-offsetY);						deltaH = -Math.abs(y-offsetY);						if(checkBounds(deltaX, deltaY, deltaW, deltaH))							startY = startY+(y-offsetY);					}					if(x-offsetX > 0)					{						deltaW = Math.abs(x-offsetX);						if(checkBounds(deltaX, deltaY, deltaW, deltaH))							offsetX = x;					}					else					{						deltaW = -Math.abs(x-offsetX);						if(checkBounds(deltaX, deltaY, deltaW, deltaH))							offsetX = x;					}				break;				case LensUI.NORTH_WEST:					if(y-offsetY < 0)					{						deltaY = (y-offsetY);						deltaH = Math.abs(y-offsetY);						if(checkBounds(deltaX, deltaY, deltaW, deltaH))							startY = startY+(y-offsetY);					}					else					{						deltaY = (y-offsetY);						deltaH = -Math.abs(y-offsetY);						if(checkBounds(deltaX, deltaY, deltaW, deltaH))							startY = startY+(y-offsetY);					}					if(x-offsetX > 0)					{						deltaX = (x-offsetX);						deltaW = -Math.abs(x-offsetX);						if(checkBounds(deltaX, deltaY, deltaW, deltaH))							startX = startX+(x-offsetX);					}					else					{						deltaX = -Math.abs(x-offsetX);						deltaW = Math.abs(x-offsetX);						if(checkBounds(deltaX, deltaY, deltaW, deltaH))							startX = startX+(x-offsetX);					}				case LensUI.SOUTH_EAST:					if(y-offsetY > 0)					{						deltaH = Math.abs(y-offsetY);						if(checkBounds(deltaX, deltaY, deltaW, deltaH))							offsetY = y;					}					else					{						deltaH = -Math.abs(y-offsetY);						if(checkBounds(deltaX, deltaY, deltaW, deltaH))							offsetY = y;					}					if(x-offsetX > 0)					{						deltaW = Math.abs(x-offsetX);						if(checkBounds(deltaX, deltaY, deltaW, deltaH))							offsetX = x;					}					else					{						deltaW = -Math.abs(x-offsetX);						if(checkBounds(deltaX, deltaY, deltaW, deltaH))							offsetX = x;					}				break;				case LensUI.SOUTH_WEST:					if(y-offsetY > 0)					{						deltaH = Math.abs(y-offsetY);						if(checkBounds(deltaX, deltaY, deltaW, deltaH))							offsetY = y;					}					else					{						deltaH = -Math.abs(y-offsetY);						if(checkBounds(deltaX, deltaY, deltaW, deltaH))							offsetY = y;					}					if(x-offsetX > 0)					{						deltaX = (x-offsetX);						deltaW = -Math.abs(x-offsetX);						if(checkBounds(deltaX, deltaY, deltaW, deltaH))							startX = startX+(x-offsetX);						}					else					{						deltaX = -Math.abs(x-offsetX);						deltaW = Math.abs(x-offsetX);						if(checkBounds(deltaX, deltaY, deltaW, deltaH))							startX = startX+(x-offsetX);					}				break;			}			setLensBounds(deltaX, deltaY, deltaW, deltaH, isShiftDown);						}		if(lensDrag)		{			boolean moveX = true;			boolean moveY = true;			if(startX+(x-offsetX) < 0 )			{				moveX = false;				startX = 0;			}			if((startX+(x-offsetX))/lensModel.getImageZoomFactor()+lensModel.getWidth() > lensModel.getImageWidth())			{				moveX = false;				startX = lensModel.getImageScaledWidth()-lensModel.getScaledWidth();			}							if(startY+(y-offsetY) < 0 )			{				moveY = false;				startY = 0;			}			if(startY+(y-offsetY)+lens.getHeight() > lensModel.getImageScaledHeight())			{				moveY = false;				startY = lensModel.getImageScaledHeight()-lensModel.getScaledHeight();			}						if(moveX)				startX = startX+(x-offsetX);			if(moveY)				startY = startY+(y-offsetY);			setLensLocation((int)(startX/lensModel.getImageZoomFactor()),					(int)(startY/lensModel.getImageZoomFactor()));		}	}