@Override
	public void mouseDragged(MouseEvent e)
	{
		if (frame.getSelectedTool() == SelectedTool.CURSOR)
		{
			Point2D.Float position = new Point2D.Float(e.getPoint().x - offset, e.getPoint().y - offset);
			Point2D.Float gridPosition = getGridPoint(position);
			if (dragDirection != null)
			{
				switch (dragDirection)
				{
				case INSIDE:
					selectedObject.setPosition(gridPosition);
					selectedObject.setEndPosition(gridPosition);
					break;
				case EAST:
					if (gridPosition.x >= selectedObject.getPosition().x)
					{
						float xOffset = gridPosition.x - selectedObject.getPosition().x;
						float oldWidth = selectedObject.getWidth();
						selectedObject.setWidth(selectedObject.getWidth() / 2 + xOffset);
						float addedWidth = selectedObject.getWidth() - oldWidth;
						selectedObject.setPosition(new Point2D.Float(selectedObject.getPosition().x + addedWidth / 2, selectedObject.getPosition().y));
					}
					break;
				case NORTH:
					if (gridPosition.y <= selectedObject.getPosition().y)
					{
						float yOffset = selectedObject.getPosition().y - gridPosition.y;
						float oldHeight = selectedObject.getHeight();
						selectedObject.setHeight(selectedObject.getHeight() / 2 + yOffset);
						float addedHeight = selectedObject.getHeight() - oldHeight;
						selectedObject.setPosition(new Point2D.Float(selectedObject.getPosition().x, selectedObject.getPosition().y - addedHeight / 2));
					}
					break;
				case NORTHEAST:
					break;
				case NORTHWEST:
					break;
				case SOUTH:
					if (gridPosition.y >= selectedObject.getPosition().y)
					{
						float yOffset = gridPosition.y - selectedObject.getPosition().y;
						float oldHeight = selectedObject.getHeight();
						selectedObject.setHeight(selectedObject.getHeight() / 2 + yOffset);
						float addedHeight = selectedObject.getHeight() - oldHeight;
						selectedObject.setPosition(new Point2D.Float(selectedObject.getPosition().x, selectedObject.getPosition().y + addedHeight / 2));
					}
					break;
				case SOUTHEAST:
					break;
				case SOUTHWEST:
					break;
				case WEST:
					if (gridPosition.x <= selectedObject.getPosition().x)
					{
						float xOffset = selectedObject.getPosition().x - gridPosition.x;
						float oldWidth = selectedObject.getWidth();
						selectedObject.setWidth(selectedObject.getWidth() / 2 + xOffset);
						float addedWidth = selectedObject.getWidth() - oldWidth;
						selectedObject.setPosition(new Point2D.Float(selectedObject.getPosition().x - addedWidth / 2, selectedObject.getPosition().y));
					}
					break;
				default:
					break;
				}
			}
			frame.toolPanel.update();
		}
	}