/// <summary> /// change transformation of vti_textOptions in dependence of the current alignment to avoid shifts /// </summary> /// <param name="layout">Layout.</param> void TransformTxt(VTextLayout.align alignment) { float width = vti_textOptions.GetBounds().size.x; switch (alignment) { case VTextLayout.align.Base: case VTextLayout.align.Start: case VTextLayout.align.Block: vti_textOptions.transform.localPosition = new Vector3(-width * 0.25f, vti_textOptions.transform.localPosition.y, vti_textOptions.transform.localPosition.z); break; case VTextLayout.align.Center: vti_textOptions.transform.localPosition = Vector3.zero; break; case VTextLayout.align.End: vti_textOptions.transform.localPosition = new Vector3(width * 0.25f, vti_textOptions.transform.localPosition.y, vti_textOptions.transform.localPosition.z); break; } }
/// <summary> /// Sets the alignment of the vti_textOptions text /// </summary> /// <param name="alignment">Alignment.</param> public void SetAlignment(VTextLayout.align alignment) { vti_textOptions.layout.Major = alignment; TransformTxt(alignment); }