[email protected] 8 years ago
parent
commit
1d2d0fbdf0

+ 9 - 6
oxygine/src/oxygine/actor/Actor.cpp

@@ -144,15 +144,18 @@ namespace oxygine
 
 
     void Actor::calcBounds2(RectF& bounds, const Transform& transform) const
     void Actor::calcBounds2(RectF& bounds, const Transform& transform) const
     {
     {
-        const Actor* c = getFirstChild().get();
-        while (c)
+        if (!(_flags & flag_boundsNoChildren))
         {
         {
-            if (c->getVisible())
+            const Actor* c = getFirstChild().get();
+            while (c)
             {
             {
-                Transform tr = c->getTransform() * transform;
-                c->calcBounds2(bounds, tr);
+                if (c->getVisible())
+                {
+                    Transform tr = c->getTransform() * transform;
+                    c->calcBounds2(bounds, tr);
+                }
+                c = c->getNextSibling().get();
             }
             }
-            c = c->getNextSibling().get();
         }
         }
 
 
         RectF rect;
         RectF rect;

+ 2 - 1
oxygine/src/oxygine/actor/Actor.h

@@ -345,7 +345,8 @@ namespace oxygine
             flag_touchChildrenEnabled   = 1 << 5,
             flag_touchChildrenEnabled   = 1 << 5,
             flag_cull                   = 1 << 6,
             flag_cull                   = 1 << 6,
             flag_fastTransform          = 1 << 7,
             flag_fastTransform          = 1 << 7,
-            flag_reserved               = 1 << 8,
+            flag_boundsNoChildren       = 1 << 8,
+            flag_reserved               = 1 << 9,
             flag_last                   = flag_reserved
             flag_last                   = flag_reserved
         };
         };
 
 

+ 1 - 0
oxygine/src/oxygine/math/Rect.h

@@ -106,6 +106,7 @@ namespace oxygine
 
 
         point2 getCenter() const {return pos + size / 2;}
         point2 getCenter() const {return pos + size / 2;}
         point2 getSize() const {return size;}
         point2 getSize() const {return size;}
+        point2 getPosition() const { return pos; }
         point2 getLeftTop() const {return pos;}
         point2 getLeftTop() const {return pos;}
         point2 getRightBottom() const {return pos + size;}
         point2 getRightBottom() const {return pos + size;}
         point2 getRightTop() const {return point2(getRight(), getTop());}
         point2 getRightTop() const {return point2(getRight(), getTop());}