Merge 0f05f43dbc
into 35b9985bf2
commit
3ede90c2b5
|
@ -16,6 +16,7 @@ namespace UnityEngine.UI.Extensions
|
||||||
|
|
||||||
public float LineThickness = 2;
|
public float LineThickness = 2;
|
||||||
public bool UseMargins;
|
public bool UseMargins;
|
||||||
|
public bool UsePivot;
|
||||||
public Vector2 Margin;
|
public Vector2 Margin;
|
||||||
public bool relativeSize;
|
public bool relativeSize;
|
||||||
|
|
||||||
|
@ -72,21 +73,18 @@ namespace UnityEngine.UI.Extensions
|
||||||
sizeX = 1;
|
sizeX = 1;
|
||||||
sizeY = 1;
|
sizeY = 1;
|
||||||
}
|
}
|
||||||
// build a new set of m_points taking into account the cap sizes.
|
|
||||||
// would be cool to support corners too, but that might be a bit tough :)
|
|
||||||
var pointList = new List<Vector2>();
|
|
||||||
pointList.Add(m_points[0]);
|
|
||||||
var capPoint = m_points[0] + (m_points[1] - m_points[0]).normalized * capSize;
|
|
||||||
pointList.Add(capPoint);
|
|
||||||
|
|
||||||
// should bail before the last point to add another cap point
|
var pointList = new List<Vector2>();
|
||||||
for (int i = 1; i < m_points.Length - 1; i++)
|
for (int i = 0; i < m_points.Length; i++)
|
||||||
{
|
{
|
||||||
pointList.Add(m_points[i]);
|
pointList.Add(m_points[i]);
|
||||||
}
|
}
|
||||||
capPoint = m_points[m_points.Length - 1] - (m_points[m_points.Length - 1] - m_points[m_points.Length - 2]).normalized * capSize;
|
|
||||||
pointList.Add(capPoint);
|
if (UsePivot)
|
||||||
pointList.Add(m_points[m_points.Length - 1]);
|
{
|
||||||
|
offsetX += rectTransform.sizeDelta.x * rectTransform.pivot.x;
|
||||||
|
offsetY += rectTransform.sizeDelta.y * rectTransform.pivot.y;
|
||||||
|
}
|
||||||
|
|
||||||
var Tempm_points = pointList.ToArray();
|
var Tempm_points = pointList.ToArray();
|
||||||
if (UseMargins)
|
if (UseMargins)
|
||||||
|
@ -135,14 +133,8 @@ namespace UnityEngine.UI.Extensions
|
||||||
if (i > 1)
|
if (i > 1)
|
||||||
vh.AddUIVertexQuad(SetVbo(new[] { prevV1, prevV2, v1, v2 }, uvs));
|
vh.AddUIVertexQuad(SetVbo(new[] { prevV1, prevV2, v1, v2 }, uvs));
|
||||||
|
|
||||||
if (i == 1)
|
|
||||||
uvs = new[] { uvTopLeft, uvBottomLeft, uvBottomCenter, uvTopCenter };
|
|
||||||
else if (i == Tempm_points.Length - 1)
|
|
||||||
uvs = new[] { uvTopCenter, uvBottomCenter, uvBottomRight, uvTopRight };
|
|
||||||
|
|
||||||
vh.AddUIVertexQuad(SetVbo(new[] { v1, v2, v3, v4 }, uvs));
|
vh.AddUIVertexQuad(SetVbo(new[] { v1, v2, v3, v4 }, uvs));
|
||||||
|
|
||||||
|
|
||||||
prevV1 = v3;
|
prevV1 = v3;
|
||||||
prevV2 = v4;
|
prevV2 = v4;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue