(Indicator) Enhanced the accuracy to get out the hidden indicator
authorSinjae Lee <sinjae4b.lee@samsung.com>
Fri, 23 May 2014 06:51:11 +0000 (15:51 +0900)
committerAdeel Kazmi <adeel.kazmi@samsung.com>
Thu, 29 May 2014 13:53:39 +0000 (14:53 +0100)
adaptors/tizen/internal/common/indicator-impl.cpp
adaptors/tizen/internal/common/indicator-impl.h

index 0413162..c9133fa 100644 (file)
@@ -53,7 +53,7 @@ namespace
 
 const float SLIDING_ANIMATION_DURATION( 0.2f ); // 200 milli seconds
 const float AUTO_INDICATOR_STAY_DURATION(3.0f); // 3 seconds
-const float SHOWING_DISTANCE_HEIGHT_RATE(0.33f);
+const float SHOWING_DISTANCE_HEIGHT_RATE(0.17f); // 10 pixels
 
 enum
 {
@@ -606,7 +606,8 @@ bool Indicator::OnTouched(Dali::Actor indicator, const Dali::TouchEvent& touchEv
         case Dali::TouchPoint::Down:
         {
           mTouchedDown = true;
-          mTouchedYPosition = touchPoint.local.y;
+          mTouchDownPosition = touchPoint.local;
+
         }
         break;
 
@@ -616,7 +617,11 @@ bool Indicator::OnTouched(Dali::Actor indicator, const Dali::TouchEvent& touchEv
         {
           if( mTouchedDown )
           {
-            if( touchPoint.local.y > mTouchedYPosition + mImageHeight * SHOWING_DISTANCE_HEIGHT_RATE )
+            float moveDistance = sqrt( (mTouchDownPosition.x - touchPoint.local.x) * (mTouchDownPosition.x - touchPoint.local.x)
+                               + (mTouchDownPosition.y - touchPoint.local.y)*(mTouchDownPosition.y - touchPoint.local.y) );
+
+            if( moveDistance > 2 * (mImageHeight * SHOWING_DISTANCE_HEIGHT_RATE) /*threshold for distance*/
+              && touchPoint.local.y - mTouchDownPosition.y > mImageHeight * SHOWING_DISTANCE_HEIGHT_RATE /*threshold for y*/ )
             {
               ShowIndicator( AUTO_INDICATOR_STAY_DURATION );
               mTouchedDown = false;
index eba1704..0031712 100644 (file)
@@ -417,7 +417,7 @@ private:
 
   bool                             mIsAnimationPlaying;  ///< Whether the animation is playing
   bool                             mTouchedDown;         ///< Whether the indicator area touched down
-  int                              mTouchedYPosition;    ///< Indicator area touched position
+  Dali::Vector2                    mTouchDownPosition;   ///< Indicator area touched down position
 
 };