X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=base%2Fdali-toolkit%2Finternal%2Fcontrols%2Fscrollable%2Fscroll-view%2Fscroll-view-impl.cpp;h=e2df7a5f60b7f7f6793a4cf9533c35ce5a64f411;hp=ccf141a8032bd4dd47a039a0cf54e2f9dafcdef9;hb=421b1cb023ab3a51842d1c7dab553e241c2301d0;hpb=865bc7d9efba2ba1ddc5e365ce99fa94ae3e9187 diff --git a/base/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.cpp b/base/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.cpp index ccf141a..e2df7a5 100644 --- a/base/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.cpp +++ b/base/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.cpp @@ -19,7 +19,11 @@ #include // EXTERNAL INCLUDES +#include +#include #include +#include +#include #include // INTERNAL INCLUDES @@ -57,8 +61,6 @@ const float FLICK_ORTHO_ANGLE_RANGE = 75.0f; const unsigned int MAXIMUM_NUMBER_OF_VALUES = 5; ///< Number of values to use for weighted pan calculation. const Vector2 DEFAULT_MOUSE_WHEEL_SCROLL_DISTANCE_STEP_PROPORTION = Vector2(0.17f, 0.1f); ///< The step of horizontal scroll distance in the proportion of stage size for each mouse wheel event received. const unsigned long MINIMUM_TIME_BETWEEN_DOWN_AND_UP_FOR_RESET( 150u ); -const float DEFAULT_OVERSHOOT_ANIMATION_DURATION = 0.35f; // time in seconds -const Vector2 OVERSCROLL_CLAMP(1.0f, 1.0f); // maximum overscroll allowed in pixels when overshoot indicator is being used const float TOUCH_DOWN_TIMER_INTERVAL = 100.0f; const float DEFAULT_SCROLL_UPDATE_DISTANCE( 30.0f ); ///< Default distance to travel in pixels for scroll update signal @@ -72,27 +74,6 @@ const Vector2 ANGLE_OUTER_CUBE_SWING(Math::PI * 0.5f, Math::PI * 0.5f); ///< ou // Helpers //////////////////////////////////////////////////////////////////////////////////////// -// TODO: GetAngle for Vector2 can be moved. -// GetAngle for Vector3 needs to be measured against a normal/plane. - -/** - * @param[in] vector The 3D vector to be measured - * @return angle in radians from 0 to 2PI - */ -float GetAngle(const Vector3& vector) -{ - return atan2(vector.y, vector.x) + Math::PI; -} - -/** - * @param[in] vector The 2D vector to be measured - * @return angle in radians from 0 to 2PI - */ -float GetAngle(const Vector2& vector) -{ - return atan2(vector.y, vector.x) + Math::PI; -} - /** * Find the vector (distance) from (a) to (b) * in domain (start) to (end) @@ -1229,10 +1210,10 @@ Vector3 ScrollView::GetDomainSize() const void ScrollView::TransformTo(const Vector3& position, DirectionBias horizontalBias, DirectionBias verticalBias) { - TransformTo(position, mSnapDuration, horizontalBias, verticalBias); + TransformTo(position, mSnapDuration, mSnapAlphaFunction, horizontalBias, verticalBias); } -void ScrollView::TransformTo(const Vector3& position, float duration, +void ScrollView::TransformTo(const Vector3& position, float duration, AlphaFunction alpha, DirectionBias horizontalBias, DirectionBias verticalBias) { Actor self( Self() ); @@ -1275,7 +1256,7 @@ void ScrollView::TransformTo(const Vector3& position, float duration, mScrollStartedSignalV2.Emit( currentScrollPosition ); bool animating = AnimateTo(-position, Vector3::ONE * duration, - mSnapAlphaFunction, + alpha, true, horizontalBias, verticalBias, @@ -1311,13 +1292,22 @@ void ScrollView::ScrollTo(const Vector3& position, float duration) ScrollTo(position, duration, DirectionBiasNone, DirectionBiasNone); } +void ScrollView::ScrollTo(const Vector3& position, float duration, AlphaFunction alpha) +{ + ScrollTo(position, duration, alpha, DirectionBiasNone, DirectionBiasNone); +} + void ScrollView::ScrollTo(const Vector3& position, float duration, DirectionBias horizontalBias, DirectionBias verticalBias) { - DALI_LOG_SCROLL_STATE("[0x%X] position[%.2f, %.2f] duration[%.2f]", - this, position.x, position.y, duration, int(horizontalBias), int(verticalBias)); + ScrollTo(position, duration, mSnapAlphaFunction, horizontalBias, verticalBias); +} - TransformTo(position, duration, horizontalBias, verticalBias); +void ScrollView::ScrollTo(const Vector3& position, float duration, AlphaFunction alpha, + DirectionBias horizontalBias, DirectionBias verticalBias) +{ + DALI_LOG_SCROLL_STATE("[0x%X] position[%.2f, %.2f] duration[%.2f], bias[%d, %d]", this, position.x, position.y, duration, int(horizontalBias), int(verticalBias)); + TransformTo(position, duration, alpha, horizontalBias, verticalBias); } void ScrollView::ScrollTo(unsigned int page) @@ -1784,7 +1774,6 @@ void ScrollView::SetOvershootEnabled(bool enabled) } if( enabled ) { - mMaxOvershoot = OVERSCROLL_CLAMP; mOvershootIndicator->AttachToScrollable(*this); } else @@ -2443,7 +2432,7 @@ void ScrollView::GestureContinuing(const Vector2& panDelta) // TODO: Upgrade to use a more powerful gesture detector (one that supports multiple touches on pan - so works as pan and flick gesture) // BUG: Gesture::Finished doesn't always return velocity on release (due to // timeDelta between last two events being 0 sometimes, or posiiton being the same) -void ScrollView::OnPan(PanGesture gesture) +void ScrollView::OnPan( const PanGesture& gesture ) { // Guard against destruction during signal emission // Note that Emit() methods are called indirectly e.g. from within ScrollView::OnGestureEx()