application.SendNotification();
application.Render();
- // Emit Started event, we should not receive the long press.
+ // Emit Started event, we should not receive the tap.
application.ProcessEvent(GenerateTap(Gesture::Started, 1u, 1u, Vector2(50.0f, 10.0f)));
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
- // LongPress possible in empty area.
+ // Tap possible in empty area.
application.ProcessEvent(GenerateTap(Gesture::Possible, 1u, 1u, Vector2(50.0f, 10.0f)));
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
- // Move actor in to the long press position.
+ // Move actor in to the tap position.
actor.SetPosition( 0.0f, 0.0f );
// Render and notify
application.SendNotification();
application.Render();
- // Emit Started event, we should not receive the long press.
+ // Emit Started event, we should not receive the tap.
application.ProcessEvent(GenerateTap(Gesture::Started, 1u, 1u, Vector2(50.0f, 10.0f)));
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
- // Normal long press in actor's area for completeness.
+ // Normal tap in actor's area for completeness.
application.ProcessEvent(GenerateTap(Gesture::Possible, 1u, 1u, Vector2(50.0f, 10.0f)));
application.ProcessEvent(GenerateTap(Gesture::Started, 1u, 1u, Vector2(50.0f, 10.0f)));
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
mMaxTapsRequired( 1 ),
mMinTouchesRequired( 1 ),
mMaxTouchesRequired( 1 ),
- mCurrentTapEvent( NULL )
+ mCurrentTapEvent( NULL ),
+ mPossibleProcessed( false )
{
}
{
case Gesture::Possible:
{
- ResetActor();
-
+ // Do a hit test and if an actor has been hit then save to see if tap event is still valid on a tap( same actor being hit )
HitTestAlgorithm::Results hitTestResults;
- if( HitTest( mStage, tapEvent.point, hitTestResults ) )
+ if ( HitTest( mStage, tapEvent.point, hitTestResults ) )
{
- // Only sets the actor if we have a hit.
SetActor( &GetImplementation( hitTestResults.actor ) );
+ mCurrentTapActor.SetActor( GetCurrentGesturedActor() );
+
+ // Indicate that we've processed a touch down. Bool should be sufficient as a change in actor will result in a cancellation
+ mPossibleProcessed = true;
+ }
+ else
+ {
+ ResetActor();
}
break;
}
case Gesture::Started:
{
- if ( GetCurrentGesturedActor() )
+ // Ensure that we're processing a hit on the current actor and that we've already processed a touch down
+ HitTestAlgorithm::Results hitTestResults;
+ if ( GetCurrentGesturedActor() && HitTest( mStage, tapEvent.point, hitTestResults ) && mPossibleProcessed )
{
- HitTestAlgorithm::Results hitTestResults;
- HitTest( mStage, tapEvent.point, hitTestResults );
-
- if ( hitTestResults.actor && ( GetCurrentGesturedActor() == &GetImplementation( hitTestResults.actor ) ) )
+ // Check that this actor is still the one that was used for the last touch down ?
+ if ( mCurrentTapActor.GetActor() == &GetImplementation( hitTestResults.actor ) )
{
- // Set mCurrentTapEvent to use inside overridden methods called from ProcessAndEmit()
mCurrentTapEvent = &tapEvent;
ProcessAndEmit( hitTestResults );
- mCurrentTapEvent = NULL;
}
-
- ResetActor();
+ mCurrentTapEvent = NULL;
+ mPossibleProcessed = false;
}
break;
}
case Gesture::Cancelled:
+ {
+ mPossibleProcessed = false;
ResetActor();
break;
+ }
case Gesture::Continuing:
DALI_ASSERT_ALWAYS( false && "Incorrect state received from Integration layer: Continuing\n" );
// INTERNAL INCLUDES
#include <dali/internal/event/events/tap-gesture-detector-impl.h>
#include <dali/internal/event/events/gesture-processor.h>
+#include "actor-observer.h"
namespace Dali
{
unsigned int mMinTouchesRequired;
unsigned int mMaxTouchesRequired;
+ ActorObserver mCurrentTapActor; ///< Observer for the current gesture actor
const Integration::TapGestureEvent* mCurrentTapEvent; ///< Pointer to current TapEvent, used when calling ProcessAndEmit()
+ bool mPossibleProcessed; ///< Indication of whether we've processed a touch down for this gestuee
};
} // namespace Internal