ClampedRect() public static method

public static ClampedRect ( Rect rect, Rect clamp, bool maintainSize ) : Rect
rect UnityEngine.Rect
clamp UnityEngine.Rect
maintainSize bool
return UnityEngine.Rect
        private static Rect GetCurrentRect(bool screenSpace, float textureWidth, float textureHeight, Vector2 startPoint, Vector2 endPoint)
        {
            Rect rect = SpriteEditorUtility.ClampedRect(SpriteEditorUtility.RoundToInt(EditorGUIExt.FromToRect(Handles.s_InverseMatrix.MultiplyPoint((Vector3)startPoint), Handles.s_InverseMatrix.MultiplyPoint((Vector3)endPoint))), new Rect(0f, 0f, textureWidth, textureHeight), false);

            if (screenSpace)
            {
                Vector2 vector  = Handles.matrix.MultiplyPoint((Vector3) new Vector2(rect.xMin, rect.yMin));
                Vector2 vector2 = Handles.matrix.MultiplyPoint((Vector3) new Vector2(rect.xMax, rect.yMax));
                rect = new Rect(vector.x, vector.y, vector2.x - vector.x, vector2.y - vector.y);
            }
            return(rect);
        }
        private static Rect GetCurrentRect(bool screenSpace, Rect clampArea, Vector2 startPoint, Vector2 endPoint)
        {
            Rect rect = EditorGUIExt.FromToRect(Handles.inverseMatrix.MultiplyPoint(startPoint), Handles.inverseMatrix.MultiplyPoint(endPoint));

            rect = SpriteEditorUtility.ClampedRect(SpriteEditorUtility.RoundToInt(rect), clampArea, false);
            if (screenSpace)
            {
                Vector2 vector  = Handles.matrix.MultiplyPoint(new Vector2(rect.xMin, rect.yMin));
                Vector2 vector2 = Handles.matrix.MultiplyPoint(new Vector2(rect.xMax, rect.yMax));
                rect = new Rect(vector.x, vector.y, vector2.x - vector.x, vector2.y - vector.y);
            }
            return(rect);
        }
        static private Rect GetCurrentRect(bool screenSpace, Rect clampArea, Vector2 startPoint, Vector2 endPoint)
        {
            Rect r = EditorGUIExt.FromToRect(Handles.inverseMatrix.MultiplyPoint(startPoint), Handles.inverseMatrix.MultiplyPoint(endPoint));

            r = SpriteEditorUtility.ClampedRect(SpriteEditorUtility.RoundToInt(r), clampArea, false);

            if (screenSpace)
            {
                Vector2 topleft     = Handles.matrix.MultiplyPoint(new Vector2(r.xMin, r.yMin));
                Vector2 bottomright = Handles.matrix.MultiplyPoint(new Vector2(r.xMax, r.yMax));

                r = new Rect(topleft.x, topleft.y, bottomright.x - topleft.x, bottomright.y - topleft.y);
            }
            return(r);
        }