private void SideCutMouseEvent()
    {
        _event = Event.current;

        int y = (int)(_sideRect.height - _event.mousePosition.y);    //This is relative to the _sideRect, since we update the event "inside" the guiutility area

        float yInRange = (float)Math.Round(y / _sideRect.height, 3); //Mouse position.y scaled to 0.0f - 1.0f range

        if (_event.type == EventType.MouseDown)
        {
            #region Drag line hit test
            int lineHitMin = y - 6;
            int lineHitMax = y + 3;

            for (int i = 1; i < _editLayers.Count; i++)
            {
                TerrainLayer tlayer = _editLayers[i];

                int minInPixels = (int)(tlayer.Bottom * _sideViewHeight);
                Debug.Log("min of " + tlayer.Name + " is " + minInPixels + ". Mouse y = " + y);
                if (minInPixels > lineHitMin && minInPixels < lineHitMax)
                {
                    bottomLayerDragged = tlayer.Clone() as TerrainLayer;
                    topLayerDraggedt   = _editLayers[i - 1].Clone() as TerrainLayer;

                    bottomDrag = i;
                    topDrag    = i - 1;
                    return;
                }
            }
            #endregion

            #region Select layer click test



            #endregion
        }

        if (_event.type == EventType.MouseDrag && bottomLayerDragged != null)
        {
            _sideCutView = SideCutTexture(GetLayerInfo());
            DrawDragLine(y);
            Repaint();
        }

        if (_event.type == EventType.MouseUp)
        {
            if (bottomLayerDragged != null)
            {
                float layerMinHeight = 0.05f;
                //minLayer.Top - layerMinHeight, yInRange);

                if (yInRange < topLayerDraggedt.Bottom + layerMinHeight || yInRange > bottomLayerDragged.Top - layerMinHeight)
                {
                    bottomLayerDragged = null;
                    topLayerDraggedt   = null;
                    return;
                }


                Debug.Log(bottomLayerDragged.Top - layerMinHeight);

                bottomLayerDragged.Bottom = yInRange;
                topLayerDraggedt.Top      = yInRange;

                _editLayers[bottomDrag] = bottomLayerDragged;
                _editLayers[topDrag]    = topLayerDraggedt;
                //Debug.Log(realLayerMin.Bottom);
                bottomLayerDragged = null;
                topLayerDraggedt   = null;
            }

            _sideCutView = SideCutTexture(GetLayerInfo());
            Repaint();
        }
    }