/// <summary>
    /// Called when the container was resized.
    /// </summary>
    /// <param name="newSize"></param>
    protected virtual void OnContainerResized(DOMRect newSize)
    {
        Width  = newSize.Width;
        Height = newSize.Height;

        Resized?.Invoke(this);
    }
Пример #2
0
        public DOMRect getBounds()
        {/* Docs: https://www.w3.org/TR/geometry-1/#dom-domquad-getbounds */
            var bounds = new DOMRect();
            var left   = MathExt.Min(p1.x, MathExt.Min(p2.x, MathExt.Min(p3.x, p4.x)));
            var top    = MathExt.Min(p1.y, MathExt.Min(p2.y, MathExt.Min(p3.y, p4.y)));
            var right  = MathExt.Max(p1.x, MathExt.Max(p2.x, MathExt.Max(p3.x, p4.x)));
            var bottom = MathExt.Max(p1.y, MathExt.Max(p2.y, MathExt.Max(p3.y, p4.y)));

            bounds.X      = left;
            bounds.Y      = top;
            bounds.Width  = right - left;
            bounds.Height = bottom - top;

            return(bounds);
        }
Пример #3
0
 public DOMRect FromRect(DOMRect rect)
 {
     // TODO: Impl
     return(null);
 }