From ad3c9bd313685e87db8fe8b3d2d8d4e0d6b81f44 Mon Sep 17 00:00:00 2001 From: Sinjae Lee Date: Fri, 23 May 2014 15:51:11 +0900 Subject: [PATCH] (Indicator) Enhanced the accuracy to get out the hidden indicator --- adaptors/tizen/internal/common/indicator-impl.cpp | 11 ++++++++--- adaptors/tizen/internal/common/indicator-impl.h | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/adaptors/tizen/internal/common/indicator-impl.cpp b/adaptors/tizen/internal/common/indicator-impl.cpp index 0413162..c9133fa 100644 --- a/adaptors/tizen/internal/common/indicator-impl.cpp +++ b/adaptors/tizen/internal/common/indicator-impl.cpp @@ -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; diff --git a/adaptors/tizen/internal/common/indicator-impl.h b/adaptors/tizen/internal/common/indicator-impl.h index eba1704..0031712 100644 --- a/adaptors/tizen/internal/common/indicator-impl.h +++ b/adaptors/tizen/internal/common/indicator-impl.h @@ -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 }; -- 2.7.4