Ver código fonte

Misc fixes to UI.

Steve Grenier 12 anos atrás
pai
commit
ec72284ff7

+ 5 - 2
gameplay/src/AbsoluteLayout.cpp

@@ -47,8 +47,11 @@ void AbsoluteLayout::update(const Container* container, const Vector2& offset)
         Control* control = controls[i];
         GP_ASSERT(control);
 
-        align(control, container);
-        control->update(container, offset);
+        if (control->isVisible())
+        {
+            align(control, container);
+            control->update(container, offset);
+        }
     }
 }
 

+ 3 - 0
gameplay/src/FlowLayout.cpp

@@ -57,6 +57,9 @@ void FlowLayout::update(const Container* container, const Vector2& offset)
         Control* control = controls.at(i);
         GP_ASSERT(control);
 
+        if (!control->isVisible())
+            continue;
+
         //align(control, container);
 
         const Rectangle& bounds = control->getBounds();

+ 4 - 0
gameplay/src/Form.cpp

@@ -685,6 +685,10 @@ static bool shouldPropagateMouseEvent(Control::State state, Mouse::MouseEvent ev
 
 bool Form::mouseEventInternal(Mouse::MouseEvent evt, int x, int y, int wheelDelta)
 {
+    // Do not process mouse input when mouse is captured
+    if (Game::getInstance()->isMouseCaptured())
+        return false;
+
     for (size_t i = 0; i < __forms.size(); ++i)
     {
         Form* form = __forms[i];

+ 5 - 1
gameplay/src/RadioButton.cpp

@@ -66,11 +66,15 @@ bool RadioButton::isSelected() const
 
 void RadioButton::setSelected(bool selected)
 {
+    if (selected)
+        RadioButton::clearSelected(_groupId);
+
     if (selected != _selected)
     {
+        _selected = selected;
         _dirty = true;
+        notifyListeners(Control::Listener::VALUE_CHANGED);
     }
-    _selected = selected;
 }
 
 void RadioButton::setImageSize(float width, float height)

+ 10 - 7
gameplay/src/VerticalLayout.cpp

@@ -63,17 +63,20 @@ void VerticalLayout::update(const Container* container, const Vector2& offset)
         Control* control = controls.at(i);
         GP_ASSERT(control);
 
-        align(control, container);
+        if (control->isVisible())
+        {
+            align(control, container);
 
-        const Rectangle& bounds = control->getBounds();
-        const Theme::Margin& margin = control->getMargin();
+            const Rectangle& bounds = control->getBounds();
+            const Theme::Margin& margin = control->getMargin();
 
-        yPosition += margin.top;
+            yPosition += margin.top;
 
-        control->setPosition(margin.left, yPosition);
-        control->update(container, offset);
+            control->setPosition(margin.left, yPosition);
+            control->update(container, offset);
 
-        yPosition += bounds.height + margin.bottom;
+            yPosition += bounds.height + margin.bottom;
+        }
 
         i += iter;
     }