public Vector2 Pivot2D()
{
Vector2 p = Vector2.zero;
float width = _width * .5f;
float height = _height * .5f;
switch (_pivot)
{
case TextAnchor.UpperLeft:
p = new Vector2(width, height);
break;
case TextAnchor.UpperCenter:
p = new Vector2(0, height);
break;
case TextAnchor.UpperRight:
p = new Vector2(-width, height);
break;
case TextAnchor.MiddleLeft:
p = new Vector2(width, 0);
break;
case TextAnchor.MiddleCenter:
p = Vector2.zero;
break;
case TextAnchor.MiddleRight:
p = new Vector2(-width, 0);
break;
case TextAnchor.LowerLeft:
p = new Vector2(width, -height);
break;
case TextAnchor.LowerCenter:
p = new Vector2(0, -height);
break;
case TextAnchor.LowerRight:
p = new Vector2(-width, -height);
break;
}
return p;
}