diff options
author | rachytski <siarhei.rachytski@gmail.com> | 2012-08-28 17:02:53 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 01:42:44 +0300 |
commit | d5d7e0e67c488a0e948d551bcc7592c414b508d9 (patch) | |
tree | 80a75c5bf68793694234253cfdaaae5916a087fa /gui | |
parent | 857bb93eb8515b7c4b49e66c96a4341a08bb93c9 (diff) |
not calling onTapEnded when tap was cancelled.
Diffstat (limited to 'gui')
-rw-r--r-- | gui/controller.cpp | 11 | ||||
-rw-r--r-- | gui/controller.hpp | 4 |
2 files changed, 13 insertions, 2 deletions
diff --git a/gui/controller.cpp b/gui/controller.cpp index b348b1f6be..6c6d44321a 100644 --- a/gui/controller.cpp +++ b/gui/controller.cpp @@ -53,6 +53,7 @@ namespace gui { m_focusedElement = l.front(); m_focusedElement->onTapStarted(pt); + m_LastTapCancelled = false; return true; } @@ -63,8 +64,11 @@ namespace gui { if (m_focusedElement) { - if (!m_focusedElement->roughHitTest(pt) || !m_focusedElement->hitTest(pt)) + if (!m_focusedElement->hitTest(pt)) + { m_focusedElement->onTapCancelled(pt); + m_LastTapCancelled = true; + } else m_focusedElement->onTapMoved(pt); @@ -79,8 +83,11 @@ namespace gui { if (m_focusedElement) { - m_focusedElement->onTapEnded(pt); + if (!m_LastTapCancelled) + m_focusedElement->onTapEnded(pt); + m_focusedElement.reset(); + m_LastTapCancelled = false; return true; } diff --git a/gui/controller.hpp b/gui/controller.hpp index 79439bac7a..f6b7e2c83f 100644 --- a/gui/controller.hpp +++ b/gui/controller.hpp @@ -60,6 +60,10 @@ namespace gui /// Screen, which is used to cache gui::Elements into display lists. yg::gl::Screen * m_CacheScreen; + /// Should we call the onTapEnded when the tap finished(we should + /// not if the tap was cancelled while moving). + bool m_LastTapCancelled; + public: /// Constructor with GestureDetector to route events from. |