Bläddra i källkod

The width of a container must contribute to the width of its parent, even if its position does not

Andrew Collier 10 år sedan
förälder
incheckning
bfe6c20f8c
1 ändrade filer med 8 tillägg och 4 borttagningar
  1. 8 4
      gameplay/src/Container.cpp

+ 8 - 4
gameplay/src/Container.cpp

@@ -554,9 +554,11 @@ void Container::updateBounds()
             for (size_t i = 0, count = _controls.size(); i < count; ++i)
             for (size_t i = 0, count = _controls.size(); i < count; ++i)
             {
             {
                 Control* ctrl = _controls[i];
                 Control* ctrl = _controls[i];
-                if (ctrl->isVisible() && !ctrl->isXPercentage() && !ctrl->isWidthPercentage())
+                if (ctrl->isVisible() && !ctrl->isWidthPercentage())
                 {
                 {
-                    float w = ctrl->getX() + ctrl->getWidth();
+                    float w = ctrl->getWidth();
+                    if (!ctrl->isXPercentage())
+                        w += ctrl->getX();
                     if (width < w)
                     if (width < w)
                         width = w;
                         width = w;
                 }
                 }
@@ -572,9 +574,11 @@ void Container::updateBounds()
             for (size_t i = 0, count = _controls.size(); i < count; ++i)
             for (size_t i = 0, count = _controls.size(); i < count; ++i)
             {
             {
                 Control* ctrl = _controls[i];
                 Control* ctrl = _controls[i];
-                if (ctrl->isVisible() && !ctrl->isYPercentage() && !ctrl->isHeightPercentage())
+                if (ctrl->isVisible() && !ctrl->isHeightPercentage())
                 {
                 {
-                    float h = ctrl->getY() + ctrl->getHeight();
+                    float h = ctrl->getHeight();
+                    if (!ctrl->isYPercentage())
+                        h += ctrl->getY();
                     if (height < h)
                     if (height < h)
                         height = h;
                         height = h;
                 }
                 }