public static Rect OnSceneGUI(SceneView sceneView)
        {
            // TODO: put somewhere else
            var curSkin = EditorGUIUtility.isProSkin;

            if (toolbarStyle == null ||
                prevSkin != curSkin)
            {
                toolbarStyle             = new GUIStyle(EditorStyles.toolbar);
                toolbarStyle.fixedHeight = kBottomBarHeight;

                toggleStyle             = new GUIStyle(EditorStyles.toolbarButton);
                toggleStyle.fixedHeight = kBottomBarHeight;

                buttonStyle             = new GUIStyle(EditorStyles.toolbarButton);
                buttonStyle.fixedHeight = kBottomBarHeight;

                floatWidthLayout = GUILayout.Width(kFloatFieldWidth);

                prevSkin = curSkin;
                CSGEditorSettings.Load();
            }


            // Calculate size of bottom bar and draw it
            Rect position = sceneView.position;

            position.x      = 0;
            position.y      = position.height - kBottomBarHeight;
            position.height = kBottomBarHeight;

            GUILayout.Window(bottomBarGuiId, position, OnBottomBarUI, "", toolbarStyle);
            CSGEditorUtility.ConsumeUnusedMouseEvents(BottomBarGUIHash, position);

            Rect dragArea = sceneView.position;

            dragArea.x       = 0;
            dragArea.y       = kTopBarHeight;
            dragArea.height -= kBottomBarHeight + kTopBarHeight;
            return(dragArea);
        }
        public void Show(Rect draggableArea)
        {
            currentDraggableArea = draggableArea;
            if (GUIUtility.hotControl == 0)
            {
                prevWindowRect = position;
            }

            currentDraggableArea.x      += kGap;
            currentDraggableArea.y      += kGap;
            currentDraggableArea.width  -= kGap + kGap;
            currentDraggableArea.height -= kGap + kGap;

            int windowId = GUIUtility.GetControlID(kWindowHash, FocusType.Passive);
            var prevSkin = GUI.skin;

            GUI.skin = EditorGUIUtility.GetBuiltinSkin(EditorSkin.Scene);
            position = GUI.Window(windowId, position, HandleWindowLogic, title);
            GUI.skin = prevSkin;

            if (position.width < minWidth)
            {
                position.width = minWidth;
            }
            if (position.height < minHeight)
            {
                position.height = minHeight;
            }

            position.x = Mathf.Clamp(position.x, currentDraggableArea.xMin, currentDraggableArea.xMax - position.width);
            position.y = Mathf.Clamp(position.y, currentDraggableArea.yMin, currentDraggableArea.yMax - position.height);

            position.xMax = Mathf.Clamp(position.xMax, currentDraggableArea.xMin + position.width, currentDraggableArea.xMax);
            position.yMax = Mathf.Clamp(position.yMax, currentDraggableArea.yMin + position.height, currentDraggableArea.yMax);

            var tempPosition = position;

            tempPosition.height -= kWindowTitleBarHeight;
            CSGEditorUtility.ConsumeUnusedMouseEvents(kWindowHash, tempPosition);
        }