@Override
	public void mouseDragged(MouseEvent e) {

		if (notLeftButton)
			return;

		Point2D worldPoint = Transformation.viewToWorld(viewport, e.getX(),
				e.getY());

		switch (mode) {

		case SQUARE:
			updater.updateSquare(shape, worldPoint.getX(), worldPoint.getY());
			break;

		case RECTANGLE:
			updater.updateRectangle(shape, worldPoint.getX(), worldPoint.getY());
			break;

		case CIRCLE:
			updater.updateCircle(shape, worldPoint.getX(), worldPoint.getY());
			break;

		case ELLIPSE:
			updater.updateEllipse(shape, worldPoint.getX(), worldPoint.getY());
			break;

		case LINE:
			updater.updateLine(shape, worldPoint.getX(), worldPoint.getY());
			break;

		case SELECT:
			if (shape != null) {
				switch (transform) {

				case TRANSLATE:
					if (shape instanceof Line) {
						Line line = (Line) shape;
						line.setX1(line.getX1() + worldPoint.getX() - x1);
						line.setY1(line.getY1() + worldPoint.getY() - y1);
						line.setX2(line.getX2() + worldPoint.getX() - x1);
						line.setY2(line.getY2() + worldPoint.getY() - y1);
					} else {
						shape.setX(shape.getX() + worldPoint.getX() - x1);
						shape.setY(shape.getY() + worldPoint.getY() - y1);
					}
					x1 = worldPoint.getX();
					y1 = worldPoint.getY();
					break;

				case RESHAPE:

					if (shape instanceof Square) {
						updater.updateSquare(shape, worldPoint.getX(),
								worldPoint.getY());
					} else if (shape instanceof Rectangle) {
						updater.updateRectangle(shape, worldPoint.getX(),
								worldPoint.getY());
					} else if (shape instanceof Circle) {
						updater.updateCircle(shape, worldPoint.getX(),
								worldPoint.getY());
					} else if (shape instanceof Ellipse) {
						updater.updateEllipse(shape, worldPoint.getX(),
								worldPoint.getY());
					} else if (shape instanceof Line) {
						updater.updateLine(shape, worldPoint.getX(),
								worldPoint.getY());
					} else if (shape instanceof Triangle) {
						updater.updateTriangle(shape,
								worldPoint.getX() - shape.getX(),
								worldPoint.getY() - shape.getY());
					}

					break;
				case ROTATE:
					updater.rotateShape(shape, worldPoint.getX(),
							worldPoint.getY());
					break;
				default:
					break;
				}
			}

		default:
			break;
		}

		GUIFunctions.refresh();
	}