예제 #1
0
    /// <summary>
    /// Integer vector field.
    /// </summary>

    static public Vector4 IntPadding(string prefix, Vector4 v)
    {
        int left   = Mathf.RoundToInt(v.x);
        int top    = Mathf.RoundToInt(v.y);
        int right  = Mathf.RoundToInt(v.z);
        int bottom = Mathf.RoundToInt(v.w);

        GUILayoutHelper.IntVector a = GUILayoutHelper.IntPair(prefix, "Left", "Top", left, top);
        GUILayoutHelper.IntVector b = GUILayoutHelper.IntPair(null, "Right", "Bottom", right, bottom);

        return(new Vector4(a.x, a.y, b.x, b.y));
    }
예제 #2
0
    /// <summary>
    /// Integer rectangle field.
    /// </summary>

    static public Rect IntRect(string prefix, Rect rect)
    {
        int left   = Mathf.RoundToInt(rect.xMin);
        int top    = Mathf.RoundToInt(rect.yMin);
        int width  = Mathf.RoundToInt(rect.width);
        int height = Mathf.RoundToInt(rect.height);

        GUILayoutHelper.IntVector a = GUILayoutHelper.IntPair(prefix, "Left", "Top", left, top);
        GUILayoutHelper.IntVector b = GUILayoutHelper.IntPair(null, "Width", "Height", width, height);

        return(new Rect(a.x, a.y, b.x, b.y));
    }