Преглед на файлове

Issue #751. Layout::align() takes a control's margin into account.
This change also adds a bottom-right-aligned button with margins to the basic form controls test.

Adam Blake преди 13 години
родител
ревизия
67ee3740ad
променени са 1 файла, в които са добавени 3 реда и са изтрити 3 реда
  1. 3 3
      gameplay/src/Layout.cpp

+ 3 - 3
gameplay/src/Layout.cpp

@@ -49,7 +49,7 @@ void Layout::align(Control* control, const Container* container)
         // Vertical alignment
         if ((control->_alignment & Control::ALIGN_BOTTOM) == Control::ALIGN_BOTTOM)
         {
-            controlBounds.y = clipHeight - controlBounds.height;
+            controlBounds.y = clipHeight - controlBounds.height - controlMargin.bottom;
         }
         else if ((control->_alignment & Control::ALIGN_VCENTER) == Control::ALIGN_VCENTER)
         {
@@ -57,7 +57,7 @@ void Layout::align(Control* control, const Container* container)
         }
         else if ((control->_alignment & Control::ALIGN_TOP) == Control::ALIGN_TOP)
         {
-            controlBounds.y = 0;
+            controlBounds.y = controlMargin.top;
         }
 
         // Horizontal alignment
@@ -71,7 +71,7 @@ void Layout::align(Control* control, const Container* container)
         }
         else if ((control->_alignment & Control::ALIGN_LEFT) == Control::ALIGN_LEFT)
         {
-            controlBounds.x = 0;
+            controlBounds.x = controlMargin.left;
         }
 
         control->setBounds(controlBounds);