(TapGesture) Added min/max taps, removed touches as it's unsupported 92/36292/4
authorAdeel Kazmi <adeel.kazmi@samsung.com>
Wed, 4 Mar 2015 15:50:15 +0000 (15:50 +0000)
committerAdeel Kazmi <adeel.kazmi@samsung.com>
Wed, 4 Mar 2015 17:30:01 +0000 (09:30 -0800)
Currently, we needed to create two tap-gesture-detectors if we wanted both a single and double tap.
Now we should be able to set the minimum/maximum taps required on each tap-gesture-detector and
just check the noOfTaps member to see how many taps we received.

The touches setter/getter was removed as this is not supported by adaptor. Better to remove this
rather than have unsupported API. Left it in the structs as it could be supported later so that
their sizes do not change when this does happen.

Change-Id: I6112197f867da5a12a2d7dcc20990202a42ca670

automated-tests/src/dali/utc-Dali-TapGestureDetector.cpp
dali/internal/event/events/tap-gesture-detector-impl.cpp
dali/internal/event/events/tap-gesture-detector-impl.h
dali/internal/event/events/tap-gesture-processor.cpp
dali/public-api/events/tap-gesture-detector.cpp
dali/public-api/events/tap-gesture-detector.h

index 2f6109c3292ced08b1e0933e51b5d3708525bb8a..ded75a2514272c02a8627d0f4182d1417a2da546 100644 (file)
@@ -154,13 +154,13 @@ int UtcDaliTapGestureDetectorNew(void)
 
   TapGestureDetector detector = TapGestureDetector::New();
   DALI_TEST_CHECK(detector);
-  DALI_TEST_EQUALS(1u, detector.GetTapsRequired(), TEST_LOCATION);
-  DALI_TEST_EQUALS(1u, detector.GetTouchesRequired(), TEST_LOCATION);
+  DALI_TEST_EQUALS(1u, detector.GetMinimumTapsRequired(), TEST_LOCATION);
+  DALI_TEST_EQUALS(1u, detector.GetMaximumTapsRequired(), TEST_LOCATION);
 
-  TapGestureDetector detector2 = TapGestureDetector::New(5u, 5u);
+  TapGestureDetector detector2 = TapGestureDetector::New( 5u );
   DALI_TEST_CHECK(detector2);
-  DALI_TEST_EQUALS(5u, detector2.GetTapsRequired(), TEST_LOCATION);
-  DALI_TEST_EQUALS(5u, detector2.GetTouchesRequired(), TEST_LOCATION);
+  DALI_TEST_EQUALS(5u, detector2.GetMinimumTapsRequired(), TEST_LOCATION);
+  DALI_TEST_EQUALS(5u, detector2.GetMaximumTapsRequired(), TEST_LOCATION);
 
   //Scoped test to test destructor
   {
@@ -231,13 +231,17 @@ int UtcDaliTapGestureSetTapsRequired(void)
 
   TapGestureDetector detector = TapGestureDetector::New();
 
-  unsigned int taps = 3;
+  const unsigned int minTaps = 3;
+  const unsigned int maxTaps = 7;
 
-  DALI_TEST_CHECK(taps != detector.GetTapsRequired());
+  DALI_TEST_CHECK( minTaps != detector.GetMinimumTapsRequired() );
+  DALI_TEST_CHECK( maxTaps != detector.GetMaximumTapsRequired() );
 
-  detector.SetTapsRequired(taps);
+  detector.SetMinimumTapsRequired( minTaps );
+  detector.SetMaximumTapsRequired( maxTaps );
 
-  DALI_TEST_EQUALS(taps, detector.GetTapsRequired(), TEST_LOCATION);
+  DALI_TEST_EQUALS( minTaps, detector.GetMinimumTapsRequired(), TEST_LOCATION );
+  DALI_TEST_EQUALS( maxTaps, detector.GetMaximumTapsRequired(), TEST_LOCATION );
 
   // Attach an actor and change the required touches
 
@@ -256,10 +260,34 @@ int UtcDaliTapGestureSetTapsRequired(void)
   detector.Attach(actor);
   detector.DetectedSignal().Connect( &application, functor );
 
+  // Ensure signal is emitted if minimum taps received
+  application.ProcessEvent(GenerateTap(Gesture::Possible, minTaps, 1u, Vector2(50.0f, 50.0f)));
+  application.ProcessEvent(GenerateTap(Gesture::Started, minTaps, 1u, Vector2(50.0f, 50.0f)));
+  DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+  DALI_TEST_EQUALS( minTaps, data.receivedGesture.numberOfTaps, TEST_LOCATION );
+  data.Reset();
+
+  // Ensure signal is emitted if maximum taps received
+  application.ProcessEvent(GenerateTap(Gesture::Possible, maxTaps, 1u, Vector2(50.0f, 50.0f)));
+  application.ProcessEvent(GenerateTap(Gesture::Started, maxTaps, 1u, Vector2(50.0f, 50.0f)));
+  DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+  DALI_TEST_EQUALS( maxTaps, data.receivedGesture.numberOfTaps, TEST_LOCATION );
+  data.Reset();
+
+  // Ensure signal is NOT emitted if outside the range
+  application.ProcessEvent(GenerateTap(Gesture::Possible, minTaps - 1, 1u, Vector2(50.0f, 50.0f)));
+  application.ProcessEvent(GenerateTap(Gesture::Started, minTaps - 1, 1u, Vector2(50.0f, 50.0f)));
+  DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
+  data.Reset();
+  application.ProcessEvent(GenerateTap(Gesture::Possible, maxTaps + 1, 1u, Vector2(50.0f, 50.0f)));
+  application.ProcessEvent(GenerateTap(Gesture::Started, maxTaps + 1, 1u, Vector2(50.0f, 50.0f)));
+  DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
+  data.Reset();
+
   TestGestureManager& gestureManager = application.GetGestureManager();
   gestureManager.Initialize();
 
-  detector.SetTapsRequired(4);
+  detector.SetMinimumTapsRequired(4);
 
   // Gesture detection should have been updated only
   DALI_TEST_EQUALS(true, gestureManager.WasCalled(TestGestureManager::UpdateType), TEST_LOCATION);
@@ -269,6 +297,16 @@ int UtcDaliTapGestureSetTapsRequired(void)
   // Reset values
   gestureManager.Initialize();
 
+  detector.SetMaximumTapsRequired(maxTaps);
+
+  // Gesture detection should NOT have been updated
+  DALI_TEST_EQUALS(false, gestureManager.WasCalled(TestGestureManager::UpdateType), TEST_LOCATION);
+  DALI_TEST_EQUALS(false, gestureManager.WasCalled(TestGestureManager::RegisterType), TEST_LOCATION);
+  DALI_TEST_EQUALS(false, gestureManager.WasCalled(TestGestureManager::UnregisterType), TEST_LOCATION);
+
+  // Reset values
+  gestureManager.Initialize();
+
   // Create a second gesture detector that requires even less maximum touches
   TapGestureDetector secondDetector = TapGestureDetector::New();
   secondDetector.Attach(actor);
@@ -277,33 +315,36 @@ int UtcDaliTapGestureSetTapsRequired(void)
   DALI_TEST_EQUALS(true, gestureManager.WasCalled(TestGestureManager::UpdateType), TEST_LOCATION);
   DALI_TEST_EQUALS(false, gestureManager.WasCalled(TestGestureManager::RegisterType), TEST_LOCATION);
   DALI_TEST_EQUALS(false, gestureManager.WasCalled(TestGestureManager::UnregisterType), TEST_LOCATION);
-  END_TEST;
-}
 
-int UtcDaliTapGestureGetTapsRequired(void)
-{
-  TestApplication application;
+  // Reset values
+  gestureManager.Initialize();
+
+  // Delete the second detector so that our detection is updated again
+  secondDetector.Reset();
+  DALI_TEST_EQUALS(true, gestureManager.WasCalled(TestGestureManager::UpdateType), TEST_LOCATION);
+  DALI_TEST_EQUALS(false, gestureManager.WasCalled(TestGestureManager::RegisterType), TEST_LOCATION);
+  DALI_TEST_EQUALS(false, gestureManager.WasCalled(TestGestureManager::UnregisterType), TEST_LOCATION);
+
+  // Set the minimum to be greater than the maximum, should Assert
+  try
+  {
+    detector.SetMinimumTapsRequired( maxTaps );
+    detector.SetMaximumTapsRequired( minTaps );
+    DALI_TEST_CHECK( false ); // Should not get here
+  }
+  catch ( DaliException& e )
+  {
+    DALI_TEST_CHECK( true );
+  }
 
-  TapGestureDetector detector = TapGestureDetector::New();
-  DALI_TEST_EQUALS(1u, detector.GetTapsRequired(), TEST_LOCATION);
   END_TEST;
 }
 
-int UtcDaliTapGestureSetTouchesRequired(void)
+int UtcDaliTapGestureSetTapsRequiredMinMaxCheck(void)
 {
   TestApplication application;
 
-  TapGestureDetector detector = TapGestureDetector::New();
-
-  unsigned int max = 3;
-
-  DALI_TEST_CHECK(max != detector.GetTouchesRequired());
-
-  detector.SetTouchesRequired(max);
-
-  DALI_TEST_EQUALS(max, detector.GetTouchesRequired(), TEST_LOCATION);
-
-  // Attach an actor and change the maximum touches
+  // Attach an actor and change the required touches
 
   Actor actor = Actor::New();
   actor.SetSize(100.0f, 100.0f);
@@ -314,42 +355,31 @@ int UtcDaliTapGestureSetTouchesRequired(void)
   application.SendNotification();
   application.Render();
 
-  SignalData data;
-  GestureReceivedFunctor functor(data);
+  // Set the minimum to be greater than the maximum, should Assert
 
-  detector.Attach(actor);
-  detector.DetectedSignal().Connect( &application, functor );
-
-  TestGestureManager& gestureManager = application.GetGestureManager();
-  gestureManager.Initialize();
-
-  detector.SetTouchesRequired(4);
-
-  // Gesture detection should have been updated only
-  DALI_TEST_EQUALS(true, gestureManager.WasCalled(TestGestureManager::UpdateType), TEST_LOCATION);
-  DALI_TEST_EQUALS(false, gestureManager.WasCalled(TestGestureManager::RegisterType), TEST_LOCATION);
-  DALI_TEST_EQUALS(false, gestureManager.WasCalled(TestGestureManager::UnregisterType), TEST_LOCATION);
-
-  // Reset values
-  gestureManager.Initialize();
-
-  // Create a second gesture detector that requires even less maximum touches
-  TapGestureDetector secondDetector = TapGestureDetector::New();
-  secondDetector.Attach(actor);
+  try
+  {
+    TapGestureDetector detector = TapGestureDetector::New();
+    detector.SetMinimumTapsRequired( 7u );
+    detector.SetMaximumTapsRequired( 3u );
+    detector.Attach(actor);
+    DALI_TEST_CHECK( false ); // Should not get here
+  }
+  catch ( DaliException& e )
+  {
+    DALI_TEST_CHECK( true );
+  }
 
-  // Gesture detection should have been updated
-  DALI_TEST_EQUALS(true, gestureManager.WasCalled(TestGestureManager::UpdateType), TEST_LOCATION);
-  DALI_TEST_EQUALS(false, gestureManager.WasCalled(TestGestureManager::RegisterType), TEST_LOCATION);
-  DALI_TEST_EQUALS(false, gestureManager.WasCalled(TestGestureManager::UnregisterType), TEST_LOCATION);
   END_TEST;
 }
 
-int UtcDaliTapGestureGetTouchesRequired(void)
+int UtcDaliTapGestureGetTapsRequired(void)
 {
   TestApplication application;
 
   TapGestureDetector detector = TapGestureDetector::New();
-  DALI_TEST_EQUALS(1u, detector.GetTouchesRequired(), TEST_LOCATION);
+  DALI_TEST_EQUALS(1u, detector.GetMinimumTapsRequired(), TEST_LOCATION);
+  DALI_TEST_EQUALS(1u, detector.GetMaximumTapsRequired(), TEST_LOCATION);
   END_TEST;
 }
 
@@ -745,9 +775,7 @@ int UtcDaliTapGestureSignalReceptionMultipleGestureDetectors(void)
     // Reset gestureManager statistics
     gestureManager.Initialize();
 
-    TapGestureDetector secondDetector = TapGestureDetector::New();
-    secondDetector.SetTapsRequired(2);
-    secondDetector.SetTouchesRequired(2);
+    TapGestureDetector secondDetector = TapGestureDetector::New( 2 );
     secondDetector.Attach(second);
     secondDetector.DetectedSignal().Connect(&application, functor);
 
@@ -756,8 +784,8 @@ int UtcDaliTapGestureSignalReceptionMultipleGestureDetectors(void)
     DALI_TEST_EQUALS(false, gestureManager.WasCalled(TestGestureManager::UnregisterType), TEST_LOCATION);
 
     // Tap within second actor's area
-    application.ProcessEvent(GenerateTap(Gesture::Possible, 2u, 2u, Vector2(150.0f, 10.0f)));
-    application.ProcessEvent(GenerateTap(Gesture::Started, 2u, 2u, Vector2(150.0f, 10.0f)));
+    application.ProcessEvent(GenerateTap(Gesture::Possible, 2u, 1u, Vector2(150.0f, 10.0f)));
+    application.ProcessEvent(GenerateTap(Gesture::Started, 2u, 1u, Vector2(150.0f, 10.0f)));
     DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
     DALI_TEST_EQUALS(true, second == data.tappedActor, TEST_LOCATION);
 
index 2d84a8d7fcadd311e284ad9180a545bd9dd07b77..d796e8d66e6b6781d44b47c3f3c0fa368ed483b7 100644 (file)
@@ -33,6 +33,9 @@ namespace Internal
 namespace
 {
 
+const unsigned int DEFAULT_TAPS_REQUIRED = 1u;
+const unsigned int DEFAULT_TOUCHES_REQUIRED = 1u;
+
 // Signals
 const char* const SIGNAL_TAP_DETECTED = "tap-detected";
 
@@ -52,22 +55,24 @@ TapGestureDetectorPtr TapGestureDetector::New()
   return new TapGestureDetector;
 }
 
-TapGestureDetectorPtr TapGestureDetector::New(unsigned int tapsRequired, unsigned int touchesRequired)
+TapGestureDetectorPtr TapGestureDetector::New( unsigned int tapsRequired )
 {
-  return new TapGestureDetector(tapsRequired, touchesRequired);
+  return new TapGestureDetector( tapsRequired );
 }
 
 TapGestureDetector::TapGestureDetector()
-: GestureDetector(Gesture::Tap),
-  mTapsRequired(1),
-  mTouchesRequired(1)
+: GestureDetector( Gesture::Tap ),
+  mMinimumTapsRequired( DEFAULT_TAPS_REQUIRED ),
+  mMaximumTapsRequired( DEFAULT_TAPS_REQUIRED ),
+  mTouchesRequired( DEFAULT_TOUCHES_REQUIRED )
 {
 }
 
-TapGestureDetector::TapGestureDetector(unsigned int tapsRequired, unsigned int touchesRequired)
-: GestureDetector(Gesture::Tap),
-  mTapsRequired(tapsRequired),
-  mTouchesRequired(touchesRequired)
+TapGestureDetector::TapGestureDetector( unsigned int tapsRequired )
+: GestureDetector( Gesture::Tap ),
+  mMinimumTapsRequired( tapsRequired ),
+  mMaximumTapsRequired( tapsRequired ),
+  mTouchesRequired( DEFAULT_TOUCHES_REQUIRED )
 {
 }
 
@@ -75,15 +80,26 @@ TapGestureDetector::~TapGestureDetector()
 {
 }
 
-void TapGestureDetector::SetTapsRequired(unsigned int taps)
+void TapGestureDetector::SetMinimumTapsRequired(unsigned int taps)
 {
-  DALI_ASSERT_ALWAYS(taps > 0 && "Can only set a positive number of taps" );
+  if ( mMinimumTapsRequired != taps )
+  {
+    mMinimumTapsRequired = taps;
+
+    if ( !mAttachedActors.empty() )
+    {
+      mGestureEventProcessor.GestureDetectorUpdated(this);
+    }
+  }
+}
 
-  if (mTapsRequired != taps)
+void TapGestureDetector::SetMaximumTapsRequired(unsigned int taps)
+{
+  if ( mMaximumTapsRequired != taps )
   {
-    mTapsRequired = taps;
+    mMaximumTapsRequired = taps;
 
-    if (!mAttachedActors.empty())
+    if ( !mAttachedActors.empty() )
     {
       mGestureEventProcessor.GestureDetectorUpdated(this);
     }
@@ -92,8 +108,6 @@ void TapGestureDetector::SetTapsRequired(unsigned int taps)
 
 void TapGestureDetector::SetTouchesRequired(unsigned int touches)
 {
-  DALI_ASSERT_ALWAYS(touches > 0 && "Can only set a positive number of touches" );
-
   if (mTouchesRequired != touches)
   {
     mTouchesRequired = touches;
@@ -105,9 +119,14 @@ void TapGestureDetector::SetTouchesRequired(unsigned int touches)
   }
 }
 
-unsigned int TapGestureDetector::GetTapsRequired() const
+unsigned int TapGestureDetector::GetMinimumTapsRequired() const
+{
+  return mMinimumTapsRequired;
+}
+
+unsigned int TapGestureDetector::GetMaximumTapsRequired() const
 {
-  return mTapsRequired;
+  return mMaximumTapsRequired;
 }
 
 unsigned int TapGestureDetector::GetTouchesRequired() const
index 7cf195aa5802b213a5a269b3a8d82f97d5252cb5..9e26d20dc46523af1364cbee057988752baf60a7 100644 (file)
@@ -51,10 +51,9 @@ public: // Creation
   /**
    * Create a new gesture detector with the specified parameters.
    * @param[in]  tapsRequired     The number of taps required.
-   * @param[in]  touchesRequired  The number of touches required.
    * @return A smart-pointer to the newly allocated detector.
    */
-  static TapGestureDetectorPtr New(unsigned int tapsRequired, unsigned int touchesRequired);
+  static TapGestureDetectorPtr New( unsigned int tapsRequired );
 
   /**
    * Construct a new GestureDetector.
@@ -64,25 +63,35 @@ public: // Creation
   /**
    * Construct a new GestureDetector with the specified parameters.
    * @param[in]  tapsRequired     The number of taps required.
-   * @param[in]  touchesRequired  The number of touches required.
    */
-  TapGestureDetector(unsigned int tapsRequired, unsigned int touchesRequired);
+  TapGestureDetector( unsigned int tapsRequired );
 
 public:
 
-  /**
-   * @copydoc Dali::TapGestureDetector::SetTapsRequired(unsigned int)
-   */
-  void SetTapsRequired(unsigned int taps);
   /**
    * @copydoc Dali::TapGestureDetector::SetTouchesRequired(unsigned int)
    */
   void SetTouchesRequired(unsigned int touches);
 
   /**
-   * @copydoc Dali::TapGestureDetector::GetTapsRequired()
+   * @copydoc Dali::TapGestureDetector::SetMinimumTapsRequired()
+   */
+  void SetMinimumTapsRequired( unsigned int minTaps );
+
+  /**
+   * @copydoc Dali::TapGestureDetector::SetMaximumTapsRequired()
+   */
+  void SetMaximumTapsRequired( unsigned int maxTaps );
+
+  /**
+   * @copydoc Dali::TapGestureDetector::GetMinimumTapsRequired()
+   */
+  unsigned int GetMinimumTapsRequired() const;
+
+  /**
+   * @copydoc Dali::TapGestureDetector::SetMaximumTapsRequired()
    */
-  unsigned int GetTapsRequired() const;
+  unsigned int GetMaximumTapsRequired() const;
 
   /**
    * @copydoc Dali::TapGestureDetector::GetTouchesRequired()
@@ -154,7 +163,8 @@ private:
 
   Dali::TapGestureDetector::DetectedSignalType mDetectedSignal;
 
-  unsigned int mTapsRequired;
+  unsigned int mMinimumTapsRequired;
+  unsigned int mMaximumTapsRequired;
   unsigned int mTouchesRequired;
 };
 
index 7ae30e530bf53ca8028cb9a97555b2f38391e82a..7629fd99f2b5b64c044eda4542292a80ba641b22 100644 (file)
@@ -158,15 +158,19 @@ void TapGestureProcessor::AddGestureDetector( TapGestureDetector* gestureDetecto
 
   mGestureDetectors.push_back(gestureDetector);
 
-  unsigned int tapsRequired = gestureDetector->GetTapsRequired();
-  unsigned int touchesRequired = gestureDetector->GetTouchesRequired();
+  const unsigned int minTapsRequired = gestureDetector->GetMinimumTapsRequired();
+  const unsigned int maxTapsRequired = gestureDetector->GetMaximumTapsRequired();
+  const unsigned int touchesRequired = gestureDetector->GetTouchesRequired();
+
+  DALI_ASSERT_ALWAYS( minTapsRequired <= maxTapsRequired && "Minimum taps requested is greater than the maximum requested" );
 
   if (firstRegistration)
   {
     // If this is the first tap gesture detector that has been added, then our minimum and maximum
     // requirements are the same as each other.
 
-    mMinTapsRequired = mMaxTapsRequired = tapsRequired;
+    mMinTapsRequired = minTapsRequired;
+    mMaxTapsRequired = maxTapsRequired;
     mMinTouchesRequired = mMaxTouchesRequired = touchesRequired;
 
     Integration::TapGestureRequest request;
@@ -182,8 +186,10 @@ void TapGestureProcessor::AddGestureDetector( TapGestureDetector* gestureDetecto
     // minimum and maximums and see if our gesture detection requirements have changed, if they
     // have, then we should ask the adaptor to update its detection policy.
 
-    unsigned int minTaps = mMinTapsRequired < tapsRequired ? mMinTapsRequired : tapsRequired;
-    unsigned int maxTaps = mMaxTapsRequired > tapsRequired ? mMaxTapsRequired : tapsRequired;
+    // This is quicker than calling UpdateDetection as there is no need to iterate through the container
+
+    unsigned int minTaps = mMinTapsRequired < minTapsRequired ? mMinTapsRequired : minTapsRequired;
+    unsigned int maxTaps = mMaxTapsRequired > maxTapsRequired ? mMaxTapsRequired : maxTapsRequired;
     unsigned int minTouches = mMinTouchesRequired < touchesRequired ? mMinTouchesRequired : touchesRequired;
     unsigned int maxTouches = mMaxTouchesRequired > touchesRequired ? mMaxTouchesRequired : touchesRequired;
 
@@ -226,6 +232,11 @@ void TapGestureProcessor::GestureDetectorUpdated( TapGestureDetector* gestureDet
 {
   DALI_ASSERT_DEBUG(find(mGestureDetectors.begin(), mGestureDetectors.end(), gestureDetector) != mGestureDetectors.end());
 
+  const unsigned int minTapsRequired = gestureDetector->GetMinimumTapsRequired();
+  const unsigned int maxTapsRequired = gestureDetector->GetMaximumTapsRequired();
+
+  DALI_ASSERT_ALWAYS( minTapsRequired <= maxTapsRequired && "Minimum taps requested is greater than the maximum requested" );
+
   UpdateDetection();
 }
 
@@ -242,11 +253,12 @@ void TapGestureProcessor::UpdateDetection()
   {
     TapGestureDetector* detector(*iter);
 
-    unsigned int tapsRequired = detector->GetTapsRequired();
-    unsigned int touchesRequired = detector->GetTouchesRequired();
+    const unsigned int minTapsRequired = detector->GetMinimumTapsRequired();
+    const unsigned int maxTapsRequired = detector->GetMaximumTapsRequired();
+    const unsigned int touchesRequired = detector->GetTouchesRequired();
 
-    minTaps = tapsRequired < minTaps ? tapsRequired : minTaps;
-    maxTaps = tapsRequired > maxTaps ? tapsRequired : maxTaps;
+    minTaps = minTapsRequired < minTaps ? minTapsRequired : minTaps;
+    maxTaps = maxTapsRequired > maxTaps ? maxTapsRequired : maxTaps;
     minTouches = touchesRequired < minTouches ? touchesRequired : minTouches;
     maxTouches = touchesRequired > maxTouches ? touchesRequired : maxTouches;
   }
@@ -269,7 +281,7 @@ bool TapGestureProcessor::CheckGestureDetector( GestureDetector* detector, Actor
 
   TapGestureDetector* tapDetector ( static_cast< TapGestureDetector* >( detector ) );
 
-  return ( tapDetector->GetTapsRequired() == mCurrentTapEvent->numberOfTaps ) &&
+  return ( ( tapDetector->GetMinimumTapsRequired() <= mCurrentTapEvent->numberOfTaps ) && ( tapDetector->GetMaximumTapsRequired() >= mCurrentTapEvent->numberOfTaps ) ) &&
          ( tapDetector->GetTouchesRequired() == mCurrentTapEvent->numberOfTouches );
 }
 
index 9661f4d63516c70982940b6770438d580e6b6203..1f2d93015aeade55abeb860a8f38496e7c95183d 100644 (file)
@@ -39,9 +39,9 @@ TapGestureDetector TapGestureDetector::New()
   return TapGestureDetector(internal.Get());
 }
 
-TapGestureDetector TapGestureDetector::New(unsigned int tapsRequired, unsigned int touchesRequired)
+TapGestureDetector TapGestureDetector::New(unsigned int tapsRequired )
 {
-  Internal::TapGestureDetectorPtr internal = Internal::TapGestureDetector::New(tapsRequired, touchesRequired);
+  Internal::TapGestureDetectorPtr internal = Internal::TapGestureDetector::New( tapsRequired );
 
   return TapGestureDetector(internal.Get());
 }
@@ -66,24 +66,24 @@ TapGestureDetector& TapGestureDetector::operator=(const TapGestureDetector& rhs)
   return *this;
 }
 
-void TapGestureDetector::SetTapsRequired(unsigned int taps)
+void TapGestureDetector::SetMinimumTapsRequired(unsigned int taps)
 {
-  GetImplementation(*this).SetTapsRequired(taps);
+  GetImplementation(*this).SetMinimumTapsRequired(taps);
 }
 
-void TapGestureDetector::SetTouchesRequired(unsigned int touches)
+void TapGestureDetector::SetMaximumTapsRequired(unsigned int taps)
 {
-  GetImplementation(*this).SetTouchesRequired(touches);
+  GetImplementation(*this).SetMaximumTapsRequired(taps);
 }
 
-unsigned int TapGestureDetector::GetTapsRequired() const
+unsigned int TapGestureDetector::GetMinimumTapsRequired() const
 {
-  return GetImplementation(*this).GetTapsRequired();
+  return GetImplementation(*this).GetMinimumTapsRequired();
 }
 
-unsigned int TapGestureDetector::GetTouchesRequired() const
+unsigned int TapGestureDetector::GetMaximumTapsRequired() const
 {
-  return GetImplementation(*this).GetTouchesRequired();
+  return GetImplementation(*this).GetMaximumTapsRequired();
 }
 
 TapGestureDetector::DetectedSignalType& TapGestureDetector::DetectedSignal()
index 6307093020174eeca48acad6524cdc35657c3352..a4acd71e79f2e96aae8e2fb49d1b2fa553f0c9d4 100644 (file)
@@ -36,7 +36,7 @@ struct TapGesture;
  * @brief This class emits a signal when a tap gesture occurs that meets the requirements set by the
  * application.
  *
- * See TapGestureDetector::SetTapsRequired and TapGestureDetector::SetTouchesRequired.
+ * See TapGestureDetector::SetTapsRequired
  *
  * A Tap Gesture is a discrete gesture, which means it does not have any state information attached
  * to it.  Please see TapGesture for more information.
@@ -50,6 +50,8 @@ struct TapGesture;
  *
  * @see TapGesture
  *
+ * @note Multi-touch taps are not currently supported. However, multiple taps (double & triple tap etc.) ARE supported.
+ *
  * Signals
  * | %Signal Name | Method                |
  * |--------------|-----------------------|
@@ -84,11 +86,10 @@ public: // Creation & Destruction
   /**
    * @brief Create an initialized TapGestureDetector with the specified parameters.
    *
-   * @param[in]  tapsRequired     The number of taps required.
-   * @param[in]  touchesRequired  The number of touches required.
+   * @param[in]  tapsRequired     The minimum & maximum number of taps required.
    * @return A handle to a newly allocated Dali resource.
    */
-  static TapGestureDetector New(unsigned int tapsRequired, unsigned int touchesRequired);
+  static TapGestureDetector New( unsigned int tapsRequired );
 
   /**
    * @brief Downcast an Object handle to TapGestureDetector handle.
@@ -125,42 +126,42 @@ public: // Creation & Destruction
 public: // Setters
 
   /**
-   * @brief Set the number of taps required.
+   * @brief Set the minimum number of taps required.
    *
    * The tap count is the number of times a user should "tap" the screen.
-   * @param[in]  taps  Taps required.
+   * @param[in]  minimumTaps  The minimum taps required.
    * @pre The gesture detector has been initialized.
    * @note The default is '1'.
    */
-  void SetTapsRequired(unsigned int taps);
+  void SetMinimumTapsRequired( unsigned int minimumTaps );
 
   /**
-   * @brief Set the number of touches required.
+   * @brief Set the maximum number of taps required.
    *
-   * The number of touches corresponds to the number of fingers a user has on the screen.
-   * @param[in]  touches  Touches required.
+   * The tap count is the number of times a user should "tap" the screen.
+   * @param[in]  maximumTaps  The maximum taps required.
    * @pre The gesture detector has been initialized.
    * @note The default is '1'.
    */
-  void SetTouchesRequired(unsigned int touches);
+  void SetMaximumTapsRequired( unsigned int maximumTaps );
 
 public: // Getters
 
   /**
-   * @brief Retrieves the number of taps required.
+   * @brief Retrieves the minimum number of taps required.
    *
-   * @return The taps required.
+   * @return The minimum taps required.
    * @pre The gesture detector has been initialized.
    */
-  unsigned int GetTapsRequired() const;
+  unsigned int GetMinimumTapsRequired() const;
 
   /**
-   * @brief Retrieves the number of touches required.
+   * @brief Retrieves the maximum number of taps required.
    *
-   * @return The number of touches required.
+   * @return The maximum taps required.
    * @pre The gesture detector has been initialized.
    */
-  unsigned int GetTouchesRequired() const;
+  unsigned int GetMaximumTapsRequired() const;
 
 public: // Signals