@Override
    public void mouseDragged(MouseEvent mouse) {
        Tool tool = controls.getTool();
        if (begin == null && selectedMessage == null) {
            graph.canvas.offX = oldOffX + (mouse.getX() - preClickX);
            graph.canvas.offY = oldOffY + (mouse.getY() - preClickY);
            GUI.gRepaint();
            return;
        }
        if (tool.type == ToolType.move) {
            for (Vertex vertex : graph.vertices) {
                if (!vertex.equals(begin)
                        && vertex
                                .isNearPoint(mouseGetX(mouse), mouseGetY(mouse), begin.getRadius())) {
                    return;
                }
            }
            begin.move(mouseGetX(mouse), mouseGetY(mouse));
            GUI.gRepaint();
        } else {
            xlast = mouseGetX(mouse);
            ylast = mouseGetY(mouse);
            GUI.gRepaint();
        }
    }