From: Adeel Kazmi Date: Wed, 18 Jun 2014 10:12:53 +0000 (+0900) Subject: (ScrollView) If animation duration is 0, then return final position in completed... X-Git-Tag: dali_1.0.0~39 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=2e26071bb888787156a04736b4118ea552cbe415;ds=sidebyside (ScrollView) If animation duration is 0, then return final position in completed signal [problem] If the animation duration is 0, we still return the current scroll position. This is wrong as in the next frame, we will be at the requested position. [cause] N/A [solution] If we do not kick off an animation, then we should check whether the duration was 0. If it was, we should return the target-position instead. Change-Id: I3e1a96b3de7ca2685a16f6dd6b8ce5aebc1c78af Signed-off-by: Adeel Kazmi --- 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 7b0a68f..160546a 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 @@ -1313,9 +1313,18 @@ void ScrollView::TransformTo(const Vector3& position, const Vector3& scale, floa // if not animating, then this pan has completed right now. Self().SetProperty(mPropertyScrolling, false); mScrolling = false; - DALI_LOG_SCROLL_STATE("[0x%X] mScrollCompletedSignalV2 2 [%.2f, %.2f]", this, currentScrollPosition.x, currentScrollPosition.y); + + // If we have no duration, then in the next update frame, we will be at the position specified as we just set. + // In this scenario, we cannot return the currentScrollPosition as this is out-of-date and should instead return the requested final position + Vector3 completedPosition( currentScrollPosition ); + if( duration <= Math::MACHINE_EPSILON_10 ) + { + completedPosition = position; + } + + DALI_LOG_SCROLL_STATE("[0x%X] mScrollCompletedSignalV2 2 [%.2f, %.2f]", this, completedPosition.x, completedPosition.y); SetScrollUpdateNotification(false); - mScrollCompletedSignalV2.Emit( currentScrollPosition ); + mScrollCompletedSignalV2.Emit( completedPosition ); } }