Exemplo n.º 1
0
 private void OnGUI()
 {
     if (_isDisplaying && enabled)
     {
         Vector2 mouseScreenPosition = _mouseTracker != null ? _mouseTracker.MouseScreenPosition : default;
         Rect    selection           = ScreenRect.GetScreenRect(_rectangleStartScreenPosition, mouseScreenPosition);
         ScreenRect.DrawScreenRect(selection, _fillColor);
         ScreenRect.DrawScreenRectBorders(selection, _borderColor, _borderThickness);
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Draws box borders on screen.
 /// </summary>
 /// <param name="rect"></param>
 /// <param name="color"></param>
 /// <param name="thickness"></param>
 public static void DrawScreenRectBorders(Rect rect, Color color, float thickness)
 {
     // Top
     ScreenRect.DrawScreenRect(new Rect(rect.xMin, rect.yMin, rect.width, thickness), color);
     // Left
     ScreenRect.DrawScreenRect(new Rect(rect.xMin, rect.yMin, thickness, rect.height), color);
     // Right
     ScreenRect.DrawScreenRect(new Rect(rect.xMax - thickness, rect.yMin, thickness, rect.height), color);
     // Bottom
     ScreenRect.DrawScreenRect(new Rect(rect.xMin, rect.yMax - thickness, rect.width, thickness), color);
 }