@Override
    public void mouseDragged(MouseEvent e, EditPanelModel editPanelModel) {
        cleanUp(editPanelModel);
        Settings settings = controller.getSessionModel().getSettings();

        if (pressedMouseEvent == null) {
            pressedMouseEvent = e;
        }
        Point pressedPoint = pressedMouseEvent.getPoint();

        /* if the mouse was pressed before this, initialize dragging */
        if (!e.getPoint().equals(pressedPoint) && pressedPoint != null) {
            Point click = calculateInversePoint(pressedPoint, editPanelModel.getTransformation());

            AccessPoint apUnderMouse = editPanelModel.getCircuit().getAccessPointAtPositon(click,
                    settings.getInt(Settings.ACCESS_POINT_SCATTER_FACTOR));

            switch (editPanelModel.getToolMode()) {
            case DEFAULT_MODE:
                if (isRightMouseButton(pressedMouseEvent)) {
                    // no brick and right click, accept selection
                    editPanelModel.setSelectionStart(click);
                    editPanelModel.setSelectionEnd(click);
                    editPanelModel.setToolMode(ToolMode.SELECT_RECT_MODE);
                    clearGhosts(editPanelModel);
                } else if (apUnderMouse != null) {
                    firstAccessPoint = apUnderMouse;
                    editPanelModel.setToolMode(ToolMode.CREATE_SINGLE_WIRE_MODE); // TODO:
                                                                                  // completly
                                                                                  // remove
                                                                                  // singlewiremode
                    clearGhosts(editPanelModel);
                }
                break;
            default:
                break;
            }

            pressedPoint = null;
        }

        Point click = calculateInversePoint(e.getPoint(), editPanelModel.getTransformation());

        switch (editPanelModel.getToolMode()) {
        case DEFAULT_MODE:
            showGhost(editPanelModel, click.x, click.y);
            break;
        case SELECT_RECT_MODE:
            editPanelModel.setSelectionEnd(click);
            break;
        case CREATE_SINGLE_WIRE_MODE:
            /* Draw a ghost wire until mouse is released. */
            Brick template = controller.getSessionModel().getCurrentBrick();
            Brick temporaryBrick = template.getNewInstance(click);
            AccessPoint temporaryAccessPoint = new AccessPointImpl(temporaryBrick, new Point(0, 0),
                    "");
            Wire ghostWire = new WireImpl(firstAccessPoint, temporaryAccessPoint);
            Set<Element> ghosts = new LinkedHashSet<Element>();
            ghosts.add(ghostWire);
            editPanelModel.setGhosts(ghosts);
            break;
        default:
            break;
        }
    }