Exemple #1
0
        private static float CalcContextWidth()
        {
            float width = GUIClip.GetTopRect().width;

            if ((width >= 1f) && (width < 40000f))
            {
                return(width);
            }
            return(currentViewWidth);
        }
Exemple #2
0
        private static float CalcContextWidth()
        {
            float num = GUIClip.GetTopRect().width;

            if (num < 1f || num >= 40000f)
            {
                num = EditorGUIUtility.currentViewWidth;
            }
            return(num);
        }
Exemple #3
0
        private Rect ReplaceClipping()
        {
            // the gui matrix applies to the clipping rectangle for the window so it needs to be removed
            // and reapplied with an adjusted rect that takes the zoom and panning into account

            // the concept for this implementation comes from the GUIScaleUtility in the MIT licensed Node Editor
            // Framework: http://www.levingaeher.com/NodeEditor/

            // https://github.com/Seneral/Node_Editor_Framework/blob/develop/Node_Editor/Utilities/GUI/GUIScaleUtility.cs

            var clipping = GUIClip.GetTopRect();
            var inverse  = GUI.matrix.inverse;
            var min      = inverse.MultiplyPoint(clipping.min);
            var max      = inverse.MultiplyPoint(clipping.max);

            // these are not documented but are public - using BeginGroup/EndGroup, which is documented, does not
            // expose the scrollOffset parameter which is necessary to work around the not entirely clear wierdness
            // that Unity does with draw positioning

            GUI.EndClip();
            GUI.BeginClip(new Rect(min, max - min), -ViewArea.min, Vector2.zero, false);

            return(clipping);
        }
 public static Rect GetGUIClipTopRect()
 {
     return(GUIClip.GetTopRect());
 }
        protected bool MouseOnTopOfInspector()
        {
            if (hasSelected == false)
            {
                return(false);
            }

            // GUIClip.Unclip sets the mouse position to include the windows tab.
            Vector2 mousePosition = GUIClip.Unclip(eventSystem.current.mousePosition) - (GUIClip.topmostRect.position - GUIClip.GetTopRect().position);

            return(inspectorRect.Contains(mousePosition));
        }
Exemple #6
0
        protected bool MouseOnTopOfInspector()
        {
            bool result;

            if (!this.hasSelected)
            {
                result = false;
            }
            else
            {
                Vector2 point = GUIClip.Unclip(this.eventSystem.current.mousePosition) - (GUIClip.topmostRect.position - GUIClip.GetTopRect().position);
                result = this.inspectorRect.Contains(point);
            }
            return(result);
        }