@Override
	public void mousePressed(MouseEvent e) {

		if (e.getButton() != MouseEvent.BUTTON1) {
			return;
		}

		notLeftButton = false;

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

		updater.setX1(worldPoint.getX());
		updater.setY1(worldPoint.getY());

		switch (mode) {

		case SQUARE:
			shape = new Square(color, worldPoint.getX(), worldPoint.getY(), 0);
			model.addShape(shape);
			break;

		case RECTANGLE:
			shape = new Rectangle(color, worldPoint.getX(), worldPoint.getY(),
					0, 0);
			model.addShape(shape);
			break;

		case CIRCLE:
			shape = new Circle(color, worldPoint.getX(), worldPoint.getY(), 0);
			model.addShape(shape);
			break;

		case ELLIPSE:
			shape = new Ellipse(color, worldPoint.getX(), worldPoint.getY(), 0,
					0);
			model.addShape(shape);
			break;

		case LINE:
			shape = new Line(color, worldPoint.getX(), worldPoint.getY(),
					worldPoint.getX(), worldPoint.getY());
			model.addShape(shape);
			break;

		case SELECT:
			x1 = worldPoint.getX();
			y1 = worldPoint.getY();
			if (shape != null) {

				Point2D fixedPoint = model.testRotationHandle(x1, y1, shape,
						viewport.getScale());

				if (fixedPoint != null) {
					transform = Transform.ROTATE;
					updater.setX1(fixedPoint.getX());
					updater.setY1(fixedPoint.getY());
					break;
				}

				fixedPoint = model.testHandles(x1, y1, shape,
						viewport.getScale());

				if (fixedPoint != null) {
					transform = Transform.RESHAPE;
					updater.setX1(fixedPoint.getX());
					updater.setY1(fixedPoint.getY());
					break;
				}
			}
			shape = model.getSelectedShape(x1, y1, 4, viewport.getScale());
			if (shape != null) {
				transform = Transform.TRANSLATE;
			}

		default:
			break;
		}

		GUIFunctions.refresh();
	}