private void HandleSelectedSceneDragging()
    {
        switch (Event.current.type)
        {
            #region Handles clicking on the edge to be draggable
            case EventType.mouseUp:
                if (Event.current.button == 0)
                {
                    _dragging = DraggingEdge.None;
                    Repaint();
                }
                break;
            case EventType.mouseDown:
                var mousePos = mousePositionInWorld;
                var dataRect = _asset[_selectedSceneIndex].rectangle;
                if (Mathf.Abs(mousePos.x - dataRect.x) < _cClickableEdgeDistance)
                    _dragging = DraggingEdge.Left;
                else
                {
                    if (Mathf.Abs(mousePos.x - (dataRect.x + dataRect.width)) < _cClickableEdgeDistance)
                        _dragging = DraggingEdge.Right;
                    else
                    {
                        if (Mathf.Abs(mousePos.y - dataRect.y) < _cClickableEdgeDistance)
                            _dragging = DraggingEdge.Top;
                        else
                        {
                            if (Mathf.Abs(mousePos.y - (dataRect.y - dataRect.height)) < _cClickableEdgeDistance)
                                _dragging = DraggingEdge.Bottom;
                            else
                                _dragging = DraggingEdge.None;
                        }
                    }
                }
                
                break;
            #endregion
            #region Draw the edge being dragged (if any)
            case EventType.repaint:
                if (_dragging == DraggingEdge.None)
                    return;

                Rect rect = GetRectWithScreenOffset(_asset[_selectedSceneIndex]);

                switch (_dragging)
                {
                    case DraggingEdge.Left:
                        _vertexCache[0] = new Vector3(rect.x + 1, rect.y + 1);
                        _vertexCache[1] = new Vector3(rect.x + _cClickableEdgeDistance - 1, rect.y + 1);
                        _vertexCache[2] = new Vector3(rect.x + _cClickableEdgeDistance - 1, rect.yMax - 1);
                        _vertexCache[3] = new Vector3(rect.x + 1, rect.yMax - 1);
                        break;
                    case DraggingEdge.Top:
                        _vertexCache[0] = new Vector3(rect.x + 1, rect.y + 1);
                        _vertexCache[1] = new Vector3(rect.x + rect.width, rect.y + 1);
                        _vertexCache[2] = new Vector3(rect.x + rect.width, rect.y + _cClickableEdgeDistance - 1);
                        _vertexCache[3] = new Vector3(rect.x + 1, rect.y + _cClickableEdgeDistance - 1);
                        break;
                    case DraggingEdge.Right:
                        _vertexCache[0] = new Vector3(rect.x + rect.width - _cClickableEdgeDistance + 1, rect.y + 1);
                        _vertexCache[1] = new Vector3(rect.x + rect.width, rect.y + 1);
                        _vertexCache[2] = new Vector3(rect.x + rect.width, rect.yMax - 1);
                        _vertexCache[3] = new Vector3(rect.x + rect.width - _cClickableEdgeDistance + 1, rect.yMax - 1);
                        break;
                    case DraggingEdge.Bottom:
                        _vertexCache[0] = new Vector3(rect.x + 1, rect.yMax - _cClickableEdgeDistance + 1);
                        _vertexCache[1] = new Vector3(rect.xMax, rect.yMax - _cClickableEdgeDistance + 1);
                        _vertexCache[2] = new Vector3(rect.xMax, rect.yMax - 1);
                        _vertexCache[3] = new Vector3(rect.x + 1, rect.yMax - 1);
                        break;

                }

                Handles.DrawSolidRectangleWithOutline(_vertexCache, Color.cyan * .7f, Color.clear);
                break;
                #endregion
        }

        HandleDragSnappingScene();
        HandleResizeDraggingScene();
    }
    /// <summary>
    /// Handles various event types concerning the cells in the window
    /// containing the map preview and layout. 
    /// </summary>
    private void HandleMap()
    {
        int i;
        Rect rectWithOffset = new Rect();

        //  I chose the method of a switch with loops in each to avoid 
        //  unnecessary Begin/EndGUI() calls

        switch (Event.current.type)
        {
            case EventType.MouseMove:
                _hoverSceneIndex = -1;
                
                for (i = 0; i < _asset.Count; i++)
                {
                    rectWithOffset = GetRectWithScreenOffset(_asset[i].rectangle);

                    if (rectWithOffset.Contains(Event.current.mousePosition))
                    {
                        _hoverSceneIndex = i;
                        Repaint();
                        break;
                    }
                }
                break;
            case EventType.mouseDown:
                //  The left button has been clicked so deselect the current scene if it exists
                if (Event.current.button == 0)
                    _selectedSceneIndex = -1;
                else break;

                for (i = 0; i < _asset.Count; i++)
                {
                    rectWithOffset = GetRectWithScreenOffset(_asset[i].rectangle);

                    if (rectWithOffset.Contains(Event.current.mousePosition))
                    {
                        if (Event.current.type == EventType.MouseDown && Event.current.button == 0)
                        {
                            _selectedSceneIndex = i;
                            _dragging = DraggingEdge.None;
                            Selection.activeObject = _asset;

                            if (Event.current.clickCount == 2)
                            {
                                if (_projectSceneCollection.SceneExists(_asset[i].name) &&
                                    EditorUtility.DisplayDialog("Open Scene",
                                        "Are you sure you want to open the scene?", "Yes", "No"))
                                {
                                    EditorApplication.OpenScene(_projectSceneCollection.GetRelativeScenePath(_asset[i].name));
                                }
                            }
                            else
                            {
                                Repaint();
                            }
                        }
                    }
                }
                break;
            case EventType.repaint:

                if (_hoverSceneIndex >= _asset.Count)
                    _hoverSceneIndex = -1;
                
                Handles.BeginGUI();

                for (i = 0; i < _asset.Count; i++)
                {
                    if (i == _selectedSceneIndex ||
                        i == _hoverSceneIndex)
                        continue;

                    DrawScene(_asset[i], Color.white);
                }

                if (_hoverSceneIndex >= 0)
                    DrawScene(_asset[_hoverSceneIndex], Color.yellow);

                if (_selectedSceneIndex >= 0)
                    DrawScene(_asset[_selectedSceneIndex], Color.red);

                Handles.EndGUI();
                break;

        }
    }