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}"); } }
public void SetVerticalAlign(Align.Vertical _valign) => Y = H * GetVAlignNormalizedOffset(_valign);
public void UpdateSize(float _w, float _h, Align.Horizontal _halign, Align.Vertical _valign) { UpdateWidth(_w, _halign); UpdateHeight(_h, _valign); }
public void UpdateHeight(float _h, Align.Vertical _valign) { H = _h; SetVerticalAlign(_valign); }
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) { }