fixed processing of GUI elements.

This commit is contained in:
rachytski 2012-10-23 22:51:27 +03:00 committed by Alex Zolotarev
parent ed51c2a859
commit 238e410ade
2 changed files with 23 additions and 13 deletions

View file

@ -64,13 +64,16 @@ namespace gui
{
if (m_focusedElement)
{
if (!m_focusedElement->hitTest(pt))
if (!m_LastTapCancelled)
{
m_focusedElement->onTapCancelled(pt);
m_LastTapCancelled = true;
if (!m_focusedElement->hitTest(pt))
{
m_focusedElement->onTapCancelled(pt);
m_LastTapCancelled = true;
}
else
m_focusedElement->onTapMoved(pt);
}
else
m_focusedElement->onTapMoved(pt);
/// event handled
return true;
@ -84,14 +87,16 @@ namespace gui
if (m_focusedElement)
{
// re-checking, whether we are above the gui element.
if (!m_focusedElement->hitTest(pt))
{
m_focusedElement->onTapCancelled(pt);
m_LastTapCancelled = true;
}
if (!m_LastTapCancelled)
m_focusedElement->onTapEnded(pt);
{
if (!m_focusedElement->hitTest(pt))
{
m_focusedElement->onTapCancelled(pt);
m_LastTapCancelled = true;
}
else
m_focusedElement->onTapEnded(pt);
}
m_focusedElement.reset();
m_LastTapCancelled = false;

View file

@ -445,11 +445,16 @@ NSInteger compareAddress(id l, id r, void * context)
{
// Cancel long-touch timer
[NSObject cancelPreviousPerformRequestsWithTarget:self];
if (tapCount == 1)
// TapCount could be zero if it was a single long (or moving) tap.
if (tapCount < 2)
{
if (f.GetGuiController()->OnTapEnded(m_Pt1))
return;
}
if (tapCount == 1)
{
// Launch single tap timer
if (m_isSticking)
[self performSelector:@selector(onSingleTap:) withObject:[NSValue valueWithCGPoint:[theTouch locationInView:self.view]] afterDelay:0.3];