UnityEditor.EditorGUIExt.FromToRect C# (CSharp) Method

FromToRect() static private method

static private FromToRect ( Vector2 start, Vector2 end ) : Rect
start Vector2
end Vector2
return UnityEngine.Rect
        internal static Rect FromToRect(Vector2 start, Vector2 end)
        {
            Rect rect = new Rect(start.x, start.y, end.x - start.x, end.y - start.y);
            if (rect.width < 0f)
            {
                rect.x += rect.width;
                rect.width = -rect.width;
            }
            if (rect.height < 0f)
            {
                rect.y += rect.height;
                rect.height = -rect.height;
            }
            return rect;
        }

Usage Example

示例#1
0
 public void OnSceneGUI()
 {
     if (this.editing && (Selection.gameObjects.Length <= 1))
     {
         s_SelectionColor = GUI.skin.settings.selectionColor;
         if (Event.current.type == EventType.Repaint)
         {
             this.DrawVertices();
         }
         Event current = Event.current;
         if (current.commandName == "SelectAll")
         {
             if (current.type == EventType.ValidateCommand)
             {
                 current.Use();
             }
             if (current.type == EventType.ExecuteCommand)
             {
                 int length = this.cloth.vertices.Length;
                 for (int i = 0; i < length; i++)
                 {
                     this.m_Selection[i] = true;
                 }
                 this.SetupSelectedMeshColors();
                 SceneView.RepaintAll();
                 this.state.ToolMode = ToolMode.Select;
                 current.Use();
             }
         }
         Handles.BeginGUI();
         if ((this.m_RectSelecting && (this.state.ToolMode == ToolMode.Select)) && (Event.current.type == EventType.Repaint))
         {
             EditorStyles.selectionRect.Draw(EditorGUIExt.FromToRect(this.m_SelectStartPoint, this.m_SelectMousePoint), GUIContent.none, false, false, false, false);
         }
         Handles.EndGUI();
         SceneViewOverlay.Window(new GUIContent("Cloth Constraints"), new SceneViewOverlay.WindowFunction(this.VertexEditing), 0, SceneViewOverlay.WindowDisplayOption.OneWindowPerTarget);
     }
 }
All Usage Examples Of UnityEditor.EditorGUIExt::FromToRect