コード例 #1
0
        private static float GetVAlignNormalizedOffset(Align.Vertical _align)
        {
            switch (_align)
            {
            case Align.Vertical.Top: return(0);

            case Align.Vertical.Middle: return(-0.5f);

            case Align.Vertical.Bottom: return(-1);

            default: throw new Exception($"Unexpected VerticalAlign type {_align}");
            }
        }
コード例 #2
0
 public void SetVerticalAlign(Align.Vertical _valign) => Y = H * GetVAlignNormalizedOffset(_valign);
コード例 #3
0
 public void UpdateSize(float _w, float _h, Align.Horizontal _halign, Align.Vertical _valign)
 {
     UpdateWidth(_w, _halign);
     UpdateHeight(_h, _valign);
 }
コード例 #4
0
 public void UpdateHeight(float _h, Align.Vertical _valign)
 {
     H = _h;
     SetVerticalAlign(_valign);
 }
コード例 #5
0
 public BoundingBox(float _w, float _h, Align.Horizontal _halign = Align.Horizontal.Center, Align.Vertical _valign = Align.Vertical.Middle)
     : this(_w * GetHAlignNormalizedOffset(_halign), _h *GetVAlignNormalizedOffset(_valign), _w, _h)
 {
 }