Esempio n. 1
0
        // This returns element.Bounds2D re-centered at origin, ie without the local
        // translation of element. Child elements should be laid out relative to this box.
        public static FixedBoxModelElement ContentBounds(IBoxModelElement element, float fPadding)
        {
            AxisAlignedBox2f bounds = element.Bounds2D;

            bounds.Translate(-bounds.Center);
            return(new FixedBoxModelElement(bounds));
        }
Esempio n. 2
0
        public static AxisAlignedBox2f LocalBounds(IBoxModelElement element)
        {
            AxisAlignedBox2f bounds = element.Bounds2D;

            bounds.Translate(-bounds.Center);
            return(bounds);
        }
Esempio n. 3
0
        public static AxisAlignedBox2f GetBounds2D(RectTransform rectT)
        {
            AxisAlignedBox2f box = rectT.rect;

            box.Translate(rectT.anchoredPosition);
            return(box);
        }
Esempio n. 4
0
        /*
         * RectTransform manipulation
         */



        public static AxisAlignedBox2f GetBounds2D(GameObject go)
        {
            RectTransform    rectT = go.GetComponent <RectTransform>();
            AxisAlignedBox2f box   = rectT.rect;

            box.Translate(rectT.anchoredPosition);
            return(box);
        }
Esempio n. 5
0
        // This returns ContentBounds with a padding offset
        public static AxisAlignedBox2f PaddedContentBounds(IBoxModelElement element, float fPadding)
        {
            AxisAlignedBox2f bounds = element.Bounds2D;

            bounds.Translate(-bounds.Center);
            bounds.Contract(fPadding);
            return(bounds);
        }