コード例 #1
0
        float PlaceView(int i, float pos, float size)
        {
            float width     = position.width;
            float height    = position.height;
            float roundPos  = GUIUtility.RoundToPixelGrid(pos);
            float roundSize = GUIUtility.RoundToPixelGrid(pos + size) - roundPos;
            Rect  newRect;

            if (vertical)
            {
                newRect = new Rect(0, roundPos, width, roundSize);
                if (i == children.Length - 1)
                {
                    newRect.height = height - roundPos;
                }
            }
            else
            {
                newRect = new Rect(roundPos, 0, roundSize, height);
                if (i == children.Length - 1)
                {
                    newRect.width = width - roundPos;
                }
            }

            children[i].position = newRect;
            return(vertical ? newRect.height : newRect.width);
        }
コード例 #2
0
ファイル: SplitView.cs プロジェクト: zvars/UnityCsReference
        void SetupRectsFromSplitter()
        {
            if (children.Length == 0)
            {
                return;
            }

            float cursor = 0;

            float total = 0;

            foreach (float size in splitState.realSizes)
            {
                total += size;
            }
            float scale = 1;

            if (total > (vertical ? position.height : position.width))
            {
                scale = (vertical ? position.height : position.width) / total;
            }

            // OSX webviews might trigger nested Repaint events when being resized
            // so we protected the GUI state at this level
            SavedGUIState state = SavedGUIState.Create();

            for (int i = 0; i < children.Length; i++)
            {
                cursor += PlaceView(i, cursor, GUIUtility.RoundToPixelGrid(splitState.realSizes[i] * scale));
            }

            state.ApplyAndForget();
        }
コード例 #3
0
        // Show the editor window.
        public void Show(ShowMode showMode, bool loadPosition, bool displayImmediately, bool setFocus)
        {
            bool useMousePos = showMode == ShowMode.AuxWindow;

            if (showMode == ShowMode.AuxWindow)
            {
                showMode = ShowMode.Utility;
            }

            if (showMode == ShowMode.Utility || showMode == ShowMode.ModalUtility || IsPopup(showMode))
            {
                m_DontSaveToLayout = true;
            }

            m_ShowMode = (int)showMode;

            // Load previous position/size
            if (!isPopup)
            {
                Load(loadPosition);
            }
            if (useMousePos)
            {
                LoadInCurrentMousePosition();
            }

            var initialMaximizedState = m_Maximized;


            Internal_Show(m_PixelRect, m_ShowMode, m_MinSize, m_MaxSize);

            // Tell the main view its now in this window (quick hack to get platform-specific code to move its views to the right window)
            if (m_RootView)
            {
                m_RootView.SetWindowRecurse(this);
            }
            Internal_SetTitle(m_Title);

            SetBackgroundColor(skinBackgroundColor);

            Internal_BringLiveAfterCreation(displayImmediately, setFocus, initialMaximizedState);

            // Window could be killed by now in user callbacks...
            if (!this)
            {
                return;
            }

            // Fit window to screen - needs to be done after bringing the window live
            position          = FitWindowRectToScreen(m_PixelRect, true, useMousePos);
            rootView.position = new Rect(0, 0, GUIUtility.RoundToPixelGrid(m_PixelRect.width), GUIUtility.RoundToPixelGrid(m_PixelRect.height));

            rootView.Reflow();

            // save position right away
            Save();

            // Restore the initial maximized state since Internal_BringLiveAfterCreation might not be reflected right away and Save() might alter it.
            m_Maximized = initialMaximizedState;
        }
コード例 #4
0
        internal RectOffset GetBorderSizeInternal()
        {
            if (!window)
            {
                return(m_BorderSize);
            }

            Rect containerWindowPosition = window.position;

            containerWindowPosition.width  = GUIUtility.RoundToPixelGrid(containerWindowPosition.width);
            containerWindowPosition.height = GUIUtility.RoundToPixelGrid(containerWindowPosition.height);

            bool customBorder = floatingWindow && windowPosition.y == 0;
            bool isBottomTab  = Mathf.Abs(windowPosition.yMax - containerWindowPosition.height) < 0.02f;

            // Reset
            m_BorderSize.left = m_BorderSize.right = m_BorderSize.top = m_BorderSize.bottom = 0;

            Rect r = windowPosition;

            if (r.xMin != 0)
            {
                m_BorderSize.left += (int)kSideBorders;
            }
            if (Mathf.Abs(r.xMax - GUIUtility.RoundToPixelGrid(window.position.width)) > 0.02f)
            {
                m_BorderSize.right += (int)kSideBorders;
            }

            m_BorderSize.top    = (int)kTabHeight + (customBorder ? kFloatingWindowTopBorderWidth : 0);
            m_BorderSize.bottom = isBottomTab ? 0 : (int)kBottomBorders;

            return(m_BorderSize);
        }
コード例 #5
0
ファイル: Zoomer.cs プロジェクト: zhxhxlzt/UnityCsReference
        void OnWheel(WheelEvent evt)
        {
            var graphView = target as GraphView;

            if (graphView == null)
            {
                return;
            }

            IPanel panel = (evt.target as VisualElement)?.panel;

            if (panel.GetCapturingElement(PointerId.mousePointerId) != null)
            {
                return;
            }

            Vector3 position = graphView.viewTransform.position;
            Vector3 scale    = graphView.viewTransform.scale;

            // TODO: augment the data to have the position as well, so we don't have to read in data from the target.
            // 0-1 ranged center relative to size
            Vector2 zoomCenter = target.ChangeCoordinatesTo(graphView.contentViewContainer, evt.localMousePosition);
            float   x          = zoomCenter.x + graphView.contentViewContainer.layout.x;
            float   y          = zoomCenter.y + graphView.contentViewContainer.layout.y;

            position += Vector3.Scale(new Vector3(x, y, 0), scale);

            // Apply the new zoom.
            float zoom = CalculateNewZoom(scale.y, -evt.delta.y, scaleStep, referenceScale, minScale, maxScale);

            scale.x = zoom;
            scale.y = zoom;
            scale.z = 1;

            position  -= Vector3.Scale(new Vector3(x, y, 0), scale);
            position.x = GUIUtility.RoundToPixelGrid(position.x);
            position.y = GUIUtility.RoundToPixelGrid(position.y);

            // Delay updating of the pixel cache so the scrolling appears smooth.
            if (graphView.elementPanel != null && keepPixelCacheOnZoom)
            {
                graphView.elementPanel.keepPixelCacheOnWorldBoundChange = true;

                if (m_OnTimerTicker == null)
                {
                    m_OnTimerTicker = graphView.schedule.Execute(OnTimer);
                }

                m_OnTimerTicker.ExecuteLater(500);

                delayRepaintScheduled = true;
            }

            graphView.UpdateViewTransform(position, scale);

            evt.StopPropagation();
        }
コード例 #6
0
        internal override void Reflow()
        {
            SetupSplitter();

            for (int k = 0; k < children.Length - 1; k++)
            {
                splitState.DoSplitter(k, k + 1, 0);
            }
            splitState.RelativeToRealSizes(vertical ? GUIUtility.RoundToPixelGrid(position.height) : GUIUtility.RoundToPixelGrid(position.width));
            SetupRectsFromSplitter();
        }
コード例 #7
0
        protected override void OldOnGUI()
        {
            var oldLabelWidth = EditorGUIUtility.labelWidth;

            EditorGUIUtility.ResetGUIState();

            // Exit if the window was destroyed after entering play mode or on domain-reload.
            if (window == null)
            {
                return;
            }

            var borderSize = GetBorderSize();

            Rect dockAreaRect            = new Rect(0, 0, position.width, position.height);
            Rect containerWindowPosition = window.position;

            containerWindowPosition.width  = GUIUtility.RoundToPixelGrid(containerWindowPosition.width);
            containerWindowPosition.height = GUIUtility.RoundToPixelGrid(containerWindowPosition.height);

            DrawDockAreaBackground(dockAreaRect);

            var   viewRect              = UpdateViewRect(dockAreaRect);
            var   titleBarRect          = new Rect(viewRect.x, dockAreaRect.y, viewRect.width, borderSize.top);
            float genericMenuLeftOffset = GetGenericMenuLeftOffset(floatingWindow && isTopRightPane);

            m_TabAreaRect = new Rect(titleBarRect.x, viewRect.y - kTabHeight, titleBarRect.width - (GetExtraButtonsWidth() + genericMenuLeftOffset), kTabHeight);

            DrawDockTitleBarBackground(titleBarRect);
            HandleTabScrolling(m_TabAreaRect);


            float genericMenuTopOffset = Styles.genericMenuTopOffset;

            if (floatingWindow && isTopRightPane)
            {
                genericMenuTopOffset = Styles.genericMenuFloatingTopOffset;
            }
            if (!ContainerWindow.s_Modal)
            {
                ShowGenericMenu(position.width - genericMenuLeftOffset, m_TabAreaRect.y + genericMenuTopOffset);
            }

            DrawTabs(m_TabAreaRect);
            HandleSplitView(); //fogbugz 1169963: in order to easily use the splitter in the gameView, it must be prioritized over DrawView(). Side effect for touch is that splitter picking zones might overlap other controls but the tabs still have higher priority so the user can undock the window in that case
            DrawView(viewRect, dockAreaRect);

            DrawTabScrollers(m_TabAreaRect);

            EditorGUI.ShowRepaints();
            Highlighter.ControlHighlightGUI(this);
            EditorGUIUtility.labelWidth = oldLabelWidth;
        }
コード例 #8
0
        void UpdateContentViewTransform()
        {
            // Adjust contentContainer's position
            var t = contentContainer.transform.position;

            var offset = scrollOffset;

            t.x = GUIUtility.RoundToPixelGrid(-offset.x);
            t.y = GUIUtility.RoundToPixelGrid(-offset.y);
            contentContainer.transform.position = t;

            this.IncrementVersion(VersionChangeType.Repaint);
        }
コード例 #9
0
ファイル: Splitter.cs プロジェクト: leek9d/UnityCsReference
        public void RelativeToRealSizes(float totalSpace)
        {
            int   k;
            float spaceToShare = totalSpace;

            for (k = 0; k < relativeSizes.Length; k++)
            {
                realSizes[k] = GUIUtility.RoundToPixelGrid(relativeSizes[k] * totalSpace);

                if (realSizes[k] < minSizes[k])
                {
                    realSizes[k] = minSizes[k];
                }

                spaceToShare -= realSizes[k];
            }

            if (spaceToShare < 0)
            {
                for (k = 0; k < relativeSizes.Length; k++)
                {
                    if (realSizes[k] > minSizes[k])
                    {
                        float spaceInThisOne = realSizes[k] - minSizes[k];
                        float spaceToTake    = -spaceToShare < spaceInThisOne ? -spaceToShare : spaceInThisOne;

                        spaceToShare += spaceToTake;
                        realSizes[k] -= spaceToTake;

                        if (spaceToShare >= 0)
                        {
                            break;
                        }
                    }
                }
            }

            int last = realSizes.Length - 1;

            if (last >= 0)
            {
                realSizes[last] += spaceToShare;      // try to avoid rounding issues

                if (realSizes[last] < minSizes[last]) // but never ignore min size!
                {
                    realSizes[last] = minSizes[last];
                }
            }
        }
コード例 #10
0
        private void UpdateContentViewTransform()
        {
            Vector3 position      = this.contentContainer.transform.position;
            Vector2 scrollOffset  = this.scrollOffset;
            bool    needsVertical = this.needsVertical;

            if (needsVertical)
            {
                scrollOffset.y += this.contentContainer.resolvedStyle.top;
            }
            position.x = GUIUtility.RoundToPixelGrid(-scrollOffset.x);
            position.y = GUIUtility.RoundToPixelGrid(-scrollOffset.y);
            this.contentContainer.transform.position = position;
            base.IncrementVersion(VersionChangeType.Repaint);
        }
コード例 #11
0
        void SetupSplitter()
        {
            float[] actualSizes = new float[children.Length];
            float[] minSizes    = new float[children.Length];

            for (int j = 0; j < children.Length; j++)
            {
                View c = (View)children[j];
                actualSizes[j] = GUIUtility.RoundToPixelGrid(vertical ? c.position.height : c.position.width);
                minSizes[j]    = GUIUtility.RoundToPixelGrid(vertical ? c.minSize.y : c.minSize.x);
            }

            splitState           = SplitterState.FromAbsolute(actualSizes, minSizes, null);
            splitState.splitSize = 10;
        }
コード例 #12
0
        internal void ShowPopupWithMode(ShowMode mode, bool giveFocus)
        {
            m_ShowMode = (int)mode;
            Internal_Show(m_PixelRect, m_ShowMode, m_MinSize, m_MaxSize);
            if (m_RootView)
            {
                m_RootView.SetWindowRecurse(this);
            }
            Internal_SetTitle(m_Title);
            Save();
            //  only set focus if mode is a popupMenu.
            Internal_BringLiveAfterCreation(true, giveFocus, false);

            // Fit window to screen - needs to be done after bringing the window live
            position          = FitWindowRectToScreen(m_PixelRect, true, false);
            rootView.position = new Rect(0, 0, GUIUtility.RoundToPixelGrid(m_PixelRect.width), GUIUtility.RoundToPixelGrid(m_PixelRect.height));
            rootView.Reflow();
        }
コード例 #13
0
ファイル: Zoomer.cs プロジェクト: zvars/UnityCsReference
        void OnWheel(WheelEvent evt)
        {
            var graphView = target as GraphView;

            if (graphView == null)
            {
                return;
            }

            IPanel panel = (evt.target as VisualElement)?.panel;

            if (panel.GetCapturingElement(PointerId.mousePointerId) != null)
            {
                return;
            }

            Vector3 position = graphView.viewTransform.position;
            Vector3 scale    = graphView.viewTransform.scale;

            // TODO: augment the data to have the position as well, so we don't have to read in data from the target.
            // 0-1 ranged center relative to size
            Vector2 zoomCenter = target.ChangeCoordinatesTo(graphView.contentViewContainer, evt.localMousePosition);
            float   x          = zoomCenter.x + graphView.contentViewContainer.layout.x;
            float   y          = zoomCenter.y + graphView.contentViewContainer.layout.y;

            position += Vector3.Scale(new Vector3(x, y, 0), scale);

            // Apply the new zoom.
            float zoom = CalculateNewZoom(scale.y, -evt.delta.y, scaleStep, referenceScale, minScale, maxScale);

            scale.x = zoom;
            scale.y = zoom;
            scale.z = 1;

            position  -= Vector3.Scale(new Vector3(x, y, 0), scale);
            position.x = GUIUtility.RoundToPixelGrid(position.x);
            position.y = GUIUtility.RoundToPixelGrid(position.y);

            graphView.UpdateViewTransform(position, scale);

            evt.StopPropagation();
        }
コード例 #14
0
ファイル: Splitter.cs プロジェクト: leek9d/UnityCsReference
            public override void SetHorizontal(float x, float width)
            {
                if (!isVertical)
                {
                    int k;

                    state.xOffset = x;

                    float alignedWidth = GUIUtility.RoundToPixelGrid(width);
                    if (alignedWidth != state.lastTotalSize)
                    {
                        state.RelativeToRealSizes(alignedWidth);
                        state.lastTotalSize = alignedWidth;

                        // maintain constraints while resizing
                        for (k = 0; k < state.realSizes.Length - 1; k++)
                        {
                            state.DoSplitter(k, k + 1, 0);
                        }
                    }

                    k = 0;

                    foreach (GUILayoutEntry i in entries)
                    {
                        float thisSize = state.realSizes[k];

                        i.SetHorizontal(GUIUtility.RoundToPixelGrid(x), GUIUtility.RoundToPixelGrid(thisSize));
                        x += thisSize + spacing;
                        k++;
                    }
                }
                else
                {
                    base.SetHorizontal(x, width);
                }
            }
 public static Vector2 RoundToPixelGrid(Vector2 v)
 {
     return(new Vector2(GUIUtility.RoundToPixelGrid(v.x), GUIUtility.RoundToPixelGrid(v.y)));
 }
コード例 #16
0
 public static float RoundToPixelGrid(float v)
 {
     return(GUIUtility.RoundToPixelGrid(v));
 }
コード例 #17
0
ファイル: Splitter.cs プロジェクト: leek9d/UnityCsReference
            public override void SetVertical(float y, float height)
            {
                rect.y = y; rect.height = height;

                RectOffset padding = style.padding;

                if (isVertical)
                {
                    // If we have a skin, adjust the sizing to take care of padding (if we don't have a skin the vertical margins have been propagated fully up the hierarchy)...
                    if (style != GUIStyle.none)
                    {
                        float topMar = padding.top, bottomMar = padding.bottom;
                        if (entries.Count != 0)
                        {
                            topMar    = Mathf.Max(topMar, ((GUILayoutEntry)entries[0]).marginTop);
                            bottomMar = Mathf.Max(bottomMar, ((GUILayoutEntry)entries[entries.Count - 1]).marginBottom);
                        }
                        y      += topMar;
                        height -= bottomMar + topMar;
                    }

                    // Set the positions
                    int k;

                    float alignedHeight = GUIUtility.RoundToPixelGrid(height);
                    if (alignedHeight != state.lastTotalSize)
                    {
                        state.RelativeToRealSizes(alignedHeight);
                        state.lastTotalSize = alignedHeight;

                        // maintain constraints while resizing
                        for (k = 0; k < state.realSizes.Length - 1; k++)
                        {
                            state.DoSplitter(k, k + 1, 0);
                        }
                    }

                    k = 0;

                    foreach (GUILayoutEntry i in entries)
                    {
                        float thisSize = state.realSizes[k];

                        i.SetVertical(GUIUtility.RoundToPixelGrid(y), GUIUtility.RoundToPixelGrid(thisSize));
                        y += thisSize + spacing;
                        k++;
                    }
                }
                else
                {
                    // If we have a GUIStyle here, we need to respect the subelements' margins
                    if (style != GUIStyle.none)
                    {
                        foreach (GUILayoutEntry i in entries)
                        {
                            float topMar     = Mathf.Max(i.marginTop, padding.top);
                            float thisY      = y + topMar;
                            float thisHeight = height - Mathf.Max(i.marginBottom, padding.bottom) - topMar;

                            if (i.stretchHeight != 0)
                            {
                                i.SetVertical(thisY, thisHeight);
                            }
                            else
                            {
                                i.SetVertical(thisY, Mathf.Clamp(thisHeight, i.minHeight, i.maxHeight));
                            }
                        }
                    }
                    else
                    {
                        // If not, the subelements' margins have already been propagated upwards to this group, so we can safely ignore them
                        float thisY      = y - marginTop;
                        float thisHeight = height + marginVertical;
                        foreach (GUILayoutEntry i in entries)
                        {
                            if (i.stretchHeight != 0)
                            {
                                i.SetVertical(thisY + i.marginTop, thisHeight - i.marginVertical);
                            }
                            else
                            {
                                i.SetVertical(thisY + i.marginTop, Mathf.Clamp(thisHeight - i.marginVertical, i.minHeight, i.maxHeight));
                            }
                        }
                    }
                }
            }
コード例 #18
0
ファイル: Splitter.cs プロジェクト: leek9d/UnityCsReference
        public static void BeginSplit(SplitterState state, GUIStyle style, bool vertical, params GUILayoutOption[] options)
        {
            float pos;
            var   g = (GUISplitterGroup)GUILayoutUtility.BeginLayoutGroup(style, null, typeof(GUISplitterGroup));

            state.ID = GUIUtility.GetControlID(splitterHash, FocusType.Passive);

            switch (Event.current.GetTypeForControl(state.ID))
            {
            case EventType.Layout:
            {
                g.state       = state;
                g.resetCoords = false;
                g.isVertical  = vertical;
                g.ApplyOptions(options);
                break;
            }

            case EventType.MouseDown:
            {
                if ((Event.current.button == 0) && (Event.current.clickCount == 1))
                {
                    float cursor = GUIUtility.RoundToPixelGrid(g.isVertical ? g.rect.y : g.rect.x);
                    pos = GUIUtility.RoundToPixelGrid(g.isVertical ? Event.current.mousePosition.y : Event.current.mousePosition.x);

                    for (int i = 0; i < state.relativeSizes.Length - 1; i++)
                    {
                        Rect splitterRect = g.isVertical ?
                                            new Rect(state.xOffset + g.rect.x, cursor + state.realSizes[i] - state.splitSize / 2, g.rect.width, state.splitSize) :
                                            new Rect(state.xOffset + cursor + state.realSizes[i] - state.splitSize / 2, g.rect.y, state.splitSize, g.rect.height);

                        if (GUIUtility.HitTest(splitterRect, Event.current))
                        {
                            state.splitterInitialOffset = pos;
                            state.currentActiveSplitter = i;
                            GUIUtility.hotControl       = state.ID;
                            Event.current.Use();
                            break;
                        }

                        cursor = GUIUtility.RoundToPixelGrid(cursor + state.realSizes[i]);
                    }
                }
                break;
            }

            case EventType.MouseDrag:
            {
                if ((GUIUtility.hotControl == state.ID) && (state.currentActiveSplitter >= 0))
                {
                    pos = g.isVertical ? Event.current.mousePosition.y : Event.current.mousePosition.x;
                    GUIUtility.RoundToPixelGrid(pos);
                    float diff = pos - state.splitterInitialOffset;

                    if (diff != 0)
                    {
                        state.splitterInitialOffset = pos;
                        state.DoSplitter(state.currentActiveSplitter, state.currentActiveSplitter + 1, diff);
                    }

                    Event.current.Use();
                }
                break;
            }

            case EventType.MouseUp:
            {
                if (GUIUtility.hotControl == state.ID)
                {
                    GUIUtility.hotControl       = 0;
                    state.currentActiveSplitter = -1;
                    state.RealToRelativeSizes();
                    Event.current.Use();
                }
                break;
            }

            case EventType.Repaint:
            {
                float cursor = GUIUtility.RoundToPixelGrid(g.isVertical ? g.rect.y : g.rect.x);

                for (var i = 0; i < state.relativeSizes.Length - 1; i++)
                {
                    var splitterRect = g.isVertical ?
                                       new Rect(state.xOffset + g.rect.x, cursor + state.realSizes[i] - state.splitSize / 2, g.rect.width, state.splitSize) :
                                       new Rect(state.xOffset + cursor + state.realSizes[i] - state.splitSize / 2, g.rect.y, state.splitSize, g.rect.height);

                    EditorGUIUtility.AddCursorRect(splitterRect, g.isVertical ? MouseCursor.ResizeVertical : MouseCursor.SplitResizeLeftRight, state.ID);

                    cursor += state.realSizes[i];
                }
            }

            break;
            }
        }
コード例 #19
0
        public void SplitGUI(Event evt)
        {
            if (splitState == null)
            {
                SetupSplitter();
            }

            SplitView sp = parent as SplitView;

            if (sp)
            {
                Event e = new Event(evt);
                e.mousePosition += new Vector2(position.x, position.y);
                sp.SplitGUI(e);
                if (e.type == EventType.Used)
                {
                    evt.Use();
                }
            }

            float pos = vertical ? evt.mousePosition.y : evt.mousePosition.x;
            int   id  = GUIUtility.GetControlID(546739, FocusType.Passive);

            controlID = id;

            switch (evt.GetTypeForControl(id))
            {
            case EventType.MouseDown:
                if (children.Length != 1)     // is there a splitter
                {
                    float cursor = vertical ? children[0].position.y : children[0].position.x;
                    cursor = GUIUtility.RoundToPixelGrid(cursor);

                    for (int i = 0; i < children.Length - 1; i++)
                    {
                        if (i >= splitState.realSizes.Length)
                        {
                            DockArea dock = GUIView.current as DockArea;
                            string   name = "Non-dock area " + GUIView.current.GetType();
                            if (dock && dock.m_Selected < dock.m_Panes.Count && dock.m_Panes[dock.m_Selected])
                            {
                                name = dock.m_Panes[dock.m_Selected].GetType().ToString();
                            }

                            if (Unsupported.IsDeveloperMode())
                            {
                                Debug.LogError("Real sizes out of bounds for: " + name + " index: " + i + " RealSizes: " + splitState.realSizes.Length);
                            }

                            SetupSplitter();
                        }
                        Rect splitterRect = vertical ?
                                            new Rect(children[0].position.x, cursor + splitState.realSizes[i] - splitState.splitSize / 2, children[0].position.width, splitState.splitSize) :
                                            new Rect(cursor + splitState.realSizes[i] - splitState.splitSize / 2, children[0].position.y, splitState.splitSize, children[0].position.height);

                        if (GUIUtility.HitTest(splitterRect, evt))
                        {
                            splitState.splitterInitialOffset = GUIUtility.RoundToPixelGrid(pos);
                            splitState.currentActiveSplitter = i;
                            GUIUtility.hotControl            = id;
                            evt.Use();
                            break;
                        }

                        cursor += splitState.realSizes[i];
                    }
                }
                break;

            case EventType.MouseDrag:
                if (children.Length > 1 && (GUIUtility.hotControl == id) && (splitState.currentActiveSplitter >= 0))
                {
                    float diff = GUIUtility.RoundToPixelGrid(pos) - splitState.splitterInitialOffset;
                    if (Mathf.Abs(diff) > 0.01f)
                    {
                        splitState.splitterInitialOffset = GUIUtility.RoundToPixelGrid(pos);
                        splitState.DoSplitter(splitState.currentActiveSplitter, splitState.currentActiveSplitter + 1, diff);
                    }

                    SetupRectsFromSplitter();


                    evt.Use();
                }
                break;

            case EventType.MouseUp:
                if (GUIUtility.hotControl == id)
                {
                    GUIUtility.hotControl = 0;
                }
                break;
            }
        }