Explorar o código

Merge pull request #1006 from ablake/next

UI Bugfixes
Sean Paul Taylor %!s(int64=12) %!d(string=hai) anos
pai
achega
d779c1290b
Modificáronse 2 ficheiros con 13 adicións e 15 borrados
  1. 11 12
      gameplay/src/Container.cpp
  2. 2 3
      gameplay/src/Joystick.cpp

+ 11 - 12
gameplay/src/Container.cpp

@@ -1720,9 +1720,6 @@ bool Container::pointerEvent(bool mouse, char evt, int x, int y, int data)
         if (withinClipBounds)
         {
             setState(Control::ACTIVE);
-            withinClipBounds = true;
-            if (eventConsumed)
-                _contactIndices++;
         }
         else if (_contactIndices == 0)
         {
@@ -1731,6 +1728,7 @@ bool Container::pointerEvent(bool mouse, char evt, int x, int y, int data)
             release();
             return false;
         }
+        _contactIndices++;
         break;
     case Mouse::MOUSE_MOVE:
         if (_state != ACTIVE)
@@ -1761,18 +1759,19 @@ bool Container::pointerEvent(bool mouse, char evt, int x, int y, int data)
         }
         break;
     case Touch::TOUCH_RELEASE:
-        if (eventConsumed && _contactIndices > 0)
-        {
+        if (_contactIndices > 0)
             _contactIndices--;
-        }
 
-        if (_state == ACTIVE && withinClipBounds)
-        {
-            setState(FOCUS);
-        }
-        else
+        if (!_contactIndices)
         {
-            setState(NORMAL);
+			if (_state == ACTIVE && withinClipBounds)
+			{
+				setState(FOCUS);
+			}
+			else
+			{
+				setState(NORMAL);
+			}
         }
         break;
     }

+ 2 - 3
gameplay/src/Joystick.cpp

@@ -171,7 +171,7 @@ bool Joystick::touchEvent(Touch::TouchEvent touchEvent, int x, int y, unsigned i
                     notifyListeners(Control::Listener::VALUE_CHANGED);
                 }
 
-                _state = ACTIVE;
+                setState(ACTIVE);
                 return _consumeInputEvents;
             }
             break;
@@ -228,8 +228,7 @@ bool Joystick::touchEvent(Touch::TouchEvent touchEvent, int x, int y, unsigned i
                     notifyListeners(Control::Listener::VALUE_CHANGED);
                 }
 
-                _state = NORMAL;
-
+                setState(NORMAL);
                 return _consumeInputEvents;
             }
             break;