예제 #1
0
 private void UpdateFooterLocation()
 {
     FooterText.alignment = FooterAnchor;
     FooterText.rectTransform.anchorMax        = FooterAnchor.Anchor();
     FooterText.rectTransform.anchorMin        = FooterAnchor.Anchor();
     FooterText.rectTransform.pivot            = FooterAnchor.Anchor();
     FooterText.rectTransform.anchoredPosition = Vector2.zero;
 }
예제 #2
0
        /// <summary>
        /// Returns the local position of the <see cref="TMP_Word"/>'s <paramref name="textAnchor"/>, e.g. <see cref="TextAnchor.MiddleLeft"/>.
        /// </summary>
        /// <param name="textAnchor"></param>
        /// <returns></returns>
        public Vector2 AnchorPosition(TextAnchor textAnchor)
        {
            var leftPos = GetEdgePosition_AsFloat(Left);
            var width   = Width;
            var x       = leftPos + (textAnchor.Anchor().x *width);

            var bottomPos = GetEdgePosition_AsFloat(Bottom);
            var height    = Height;
            var y         = bottomPos + (textAnchor.Anchor().y *height);

            return(new Vector2(x, y));
        }