GetBounds() public method

public GetBounds ( DisplayObject targetSpace ) : Rect
targetSpace DisplayObject
return UnityEngine.Rect
Example #1
0
        private void CollectChildren(Container initiator, bool outlineChanged)
        {
            int count = _children.Count;

            for (int i = 0; i < count; i++)
            {
                DisplayObject child = _children[i];
                if (!child.visible)
                {
                    continue;
                }

                if (child is Container)
                {
                    Container container = (Container)child;
                    if (container._fBatchingRoot)
                    {
                        initiator._descendants.Add(container);
                        if (outlineChanged || container._outlineChanged)
                        {
                            Rect rect = container.GetBounds(initiator);
                            container._internal_bounds[0] = rect.xMin;
                            container._internal_bounds[1] = rect.yMin;
                            container._internal_bounds[2] = rect.xMax;
                            container._internal_bounds[3] = rect.yMax;
                        }
                        if (container._fBatchingRequested)
                        {
                            container.DoFairyBatching();
                        }
                    }
                    else
                    {
                        container.CollectChildren(initiator, outlineChanged || container._outlineChanged);
                    }
                }
                else if (child != initiator._mask)
                {
                    if (outlineChanged || child._outlineChanged)
                    {
                        Rect rect = child.GetBounds(initiator);
                        child._internal_bounds[0] = rect.xMin;
                        child._internal_bounds[1] = rect.yMin;
                        child._internal_bounds[2] = rect.xMax;
                        child._internal_bounds[3] = rect.yMax;
                    }
                    initiator._descendants.Add(child);
                }

                child._outlineChanged = false;
            }
        }
Example #2
0
 static public int GetBounds(IntPtr l)
 {
     try {
         FairyGUI.Container     self = (FairyGUI.Container)checkSelf(l);
         FairyGUI.DisplayObject a1;
         checkType(l, 2, out a1);
         var ret = self.GetBounds(a1);
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Example #3
0
 static int GetBounds(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         FairyGUI.Container     obj  = (FairyGUI.Container)ToLua.CheckObject <FairyGUI.Container>(L, 1);
         FairyGUI.DisplayObject arg0 = (FairyGUI.DisplayObject)ToLua.CheckObject <FairyGUI.DisplayObject>(L, 2);
         UnityEngine.Rect       o    = obj.GetBounds(arg0);
         ToLua.PushValue(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Example #4
0
        private void CollectChildren(Container initiator, bool outlineChanged)
        {
            int count = _children.Count;

            for (int i = 0; i < count; i++)
            {
                DisplayObject child = _children[i];
                if (!child.visible)
                {
                    continue;
                }

                if (child._batchingBounds == null)
                {
                    child._batchingBounds = new float[4];
                }

                if (child is Container)
                {
                    Container container = (Container)child;
                    if ((container._flags & Flags.BatchingRoot) != 0)
                    {
                        initiator._descendants.Add(container);
                        if (outlineChanged || (container._flags & Flags.OutlineChanged) != 0)
                        {
                            Rect rect = container.GetBounds(initiator);
                            if (container._clampInParentBound)
                            {
                                Rect parentRect = GetSelfBounds(initiator);
                                container._batchingBounds[0] = Mathf.Max(parentRect.xMin, rect.xMin);
                                container._batchingBounds[1] = Mathf.Max(parentRect.yMin, rect.yMin);
                                container._batchingBounds[2] = Mathf.Min(parentRect.xMax, rect.xMax);
                                container._batchingBounds[3] = Mathf.Min(parentRect.yMax, rect.yMax);
                            }
                            else
                            {
                                container._batchingBounds[0] = rect.xMin;
                                container._batchingBounds[1] = rect.yMin;
                                container._batchingBounds[2] = rect.xMax;
                                container._batchingBounds[3] = rect.yMax;
                            }
                        }
                        if ((container._flags & Flags.BatchingRequested) != 0)
                        {
                            container.DoFairyBatching();
                        }
                    }
                    else
                    {
                        container.CollectChildren(initiator, outlineChanged || (container._flags & Flags.OutlineChanged) != 0);
                    }
                }
                else if (child != initiator._mask)
                {
                    if (outlineChanged || (child._flags & Flags.OutlineChanged) != 0)
                    {
                        Rect rect = child.GetBounds(initiator);
                        if (child._clampInParentBound)
                        {
                            Rect parentRect = GetSelfBounds(initiator);
                            child._batchingBounds[0] = Mathf.Max(parentRect.xMin, rect.xMin);
                            child._batchingBounds[1] = Mathf.Max(parentRect.yMin, rect.yMin);
                            child._batchingBounds[2] = Mathf.Min(parentRect.xMax, rect.xMax);
                            child._batchingBounds[3] = Mathf.Min(parentRect.yMax, rect.yMax);
                        }
                        else
                        {
                            child._batchingBounds[0] = rect.xMin;
                            child._batchingBounds[1] = rect.yMin;
                            child._batchingBounds[2] = rect.xMax;
                            child._batchingBounds[3] = rect.yMax;
                        }
                    }
                    initiator._descendants.Add(child);
                }

                child._flags &= ~Flags.OutlineChanged;
            }
        }