示例#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));
        }
示例#2
0
        public static AxisAlignedBox2f LocalBounds(IBoxModelElement element)
        {
            AxisAlignedBox2f bounds = element.Bounds2D;

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

            box.Translate(rectT.anchoredPosition);
            return(box);
        }
示例#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);
        }
示例#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);
        }