From: Adeel Kazmi Date: Mon, 26 Oct 2015 10:44:26 +0000 (-0700) Subject: Merge "Fixed typo in ImageView::GetNaturalSize()." into devel/master X-Git-Tag: dali_1.1.8~8 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=49756b2890a35a8875fb5d619992d99991fe15e4;hp=6ae4991bdd809a65e1f1a520efe88d2df16ed846 Merge "Fixed typo in ImageView::GetNaturalSize()." into devel/master --- diff --git a/dali-toolkit/internal/controls/scrollable/item-view/item-view-impl.cpp b/dali-toolkit/internal/controls/scrollable/item-view/item-view-impl.cpp index 27054bd..a181c9a 100644 --- a/dali-toolkit/internal/controls/scrollable/item-view/item-view-impl.cpp +++ b/dali-toolkit/internal/controls/scrollable/item-view/item-view-impl.cpp @@ -289,26 +289,27 @@ Dali::Toolkit::ItemView ItemView::New(ItemFactory& factory) ItemView::ItemView(ItemFactory& factory) : Scrollable( ControlBehaviour( DISABLE_SIZE_NEGOTIATION | REQUIRES_WHEEL_EVENTS | REQUIRES_KEYBOARD_NAVIGATION_SUPPORT ) ), mItemFactory(factory), + mItemsParentOrigin(ParentOrigin::CENTER), + mItemsAnchorPoint(AnchorPoint::CENTER), + mTotalPanDisplacement(Vector2::ZERO), mActiveLayout(NULL), - mAnimatingOvershootOn(false), - mAnimateOvershootOff(false), - mAnchoringEnabled(false), mAnchoringDuration(DEFAULT_ANCHORING_DURATION), mRefreshIntervalLayoutPositions(0.0f), - mRefreshOrderHint(true/*Refresh item 0 first*/), mMinimumSwipeSpeed(DEFAULT_MINIMUM_SWIPE_SPEED), mMinimumSwipeDistance(DEFAULT_MINIMUM_SWIPE_DISTANCE), mWheelScrollDistanceStep(0.0f), mScrollDistance(0.0f), mScrollSpeed(0.0f), - mTotalPanDisplacement(Vector2::ZERO), mScrollOvershoot(0.0f), - mIsFlicking(false), mGestureState(Gesture::Clear), + mAnimatingOvershootOn(false), + mAnimateOvershootOff(false), + mAnchoringEnabled(false), + mRefreshOrderHint(true/*Refresh item 0 first*/), + mIsFlicking(false), mAddingItems(false), mRefreshEnabled(true), - mItemsParentOrigin( ParentOrigin::CENTER), - mItemsAnchorPoint( AnchorPoint::CENTER) + mInAnimation(false) { } @@ -1193,7 +1194,30 @@ void ItemView::OnPan( const PanGesture& gesture ) } mScrollOvershoot = CalculateScrollOvershoot(); - self.SetProperty( Toolkit::ItemView::Property::OVERSHOOT, mScrollOvershoot ); + + // If the view is moved in a direction against the overshoot indicator, then the indicator should be animated off. + // First make sure we are not in an animation, otherwise a previously started + // off-animation will be overwritten as the user continues scrolling. + if( !mInAnimation ) + { + // Check if the movement is against the current overshoot amount (if we are currently displaying the indicator). + if( ( ( mScrollOvershoot > Math::MACHINE_EPSILON_0 ) && ( mScrollDistance < -Math::MACHINE_EPSILON_0 ) ) || + ( ( mScrollOvershoot < Math::MACHINE_EPSILON_0 ) && ( mScrollDistance > Math::MACHINE_EPSILON_0 ) ) ) + { + // The user has moved against the indicator direction. + // First, we reset the total displacement. This means the overshoot amount will become zero the next frame, + // and if the user starts dragging in the overshoot direction again, the indicator will appear once more. + mTotalPanDisplacement = Vector2::ZERO; + // Animate the overshoot indicator off. + AnimateScrollOvershoot( 0.0f, false ); + } + else + { + // Only set the property directly if we are not animating the overshoot away, + // as otherwise this will overwrite the animation generated value. + self.SetProperty( Toolkit::ItemView::Property::OVERSHOOT, mScrollOvershoot ); + } + } } break; @@ -1331,6 +1355,7 @@ void ItemView::OnOvershootOnFinished(Animation& animation) { AnimateScrollOvershoot(0.0f); } + mInAnimation = false; } void ItemView::ScrollToItem(unsigned int itemId, float durationSeconds) @@ -1577,13 +1602,14 @@ void ItemView::AnimateScrollOvershoot(float overshootAmount, bool animateBack) duration = mOvershootOverlay.GetCurrentSize().height * (animatingOn ? (1.0f - fabsf(currentOvershoot)) : fabsf(currentOvershoot)) / mOvershootAnimationSpeed; } + // Mark the animation as in progress to prevent manual property sets overwriting it. + mInAnimation = true; + mAnimatingOvershootOn = animatingOn; RemoveAnimation(mScrollOvershootAnimation); mScrollOvershootAnimation = Animation::New(duration); mScrollOvershootAnimation.FinishedSignal().Connect(this, &ItemView::OnOvershootOnFinished); mScrollOvershootAnimation.AnimateTo( Property(self, Toolkit::ItemView::Property::OVERSHOOT), overshootAmount, TimePeriod(0.0f, duration) ); mScrollOvershootAnimation.Play(); - - mAnimatingOvershootOn = animatingOn; } else { diff --git a/dali-toolkit/internal/controls/scrollable/item-view/item-view-impl.h b/dali-toolkit/internal/controls/scrollable/item-view/item-view-impl.h index 9fc58aa..2fe5e09 100644 --- a/dali-toolkit/internal/controls/scrollable/item-view/item-view-impl.h +++ b/dali-toolkit/internal/controls/scrollable/item-view/item-view-impl.h @@ -561,58 +561,44 @@ private: private: - ItemFactory& mItemFactory; - typedef std::map ItemPool; typedef ItemPool::iterator ItemPoolIter; typedef ItemPool::const_iterator ConstItemPoolIter; ItemPool mItemPool; - - std::vector< ItemLayoutPtr > mLayouts; ///< Container of Dali::Toolkit::ItemLayout objects - ItemLayout* mActiveLayout; - Vector3 mActiveLayoutTargetSize; - + ItemFactory& mItemFactory; + std::vector< ItemLayoutPtr > mLayouts; ///< Container of Dali::Toolkit::ItemLayout objects + Actor mOvershootOverlay; ///< The overlay actor for overshoot effect Animation mResizeAnimation; Animation mScrollAnimation; Animation mScrollOvershootAnimation; - bool mAnimatingOvershootOn; ///< whether we are currently animating overshoot to 1.0f/-1.0f (on) or to 0.0f (off) - bool mAnimateOvershootOff; ///< whether we are currently animating overshoot to 1.0f/-1.0f (on) or to 0.0f (off) + Timer mWheelEventFinishedTimer; ///< The timer to determine whether there is no wheel event received for a certain period of time. + PropertyNotification mRefreshNotification; ///< Stores the property notification used for item view refresh + LayoutActivatedSignalType mLayoutActivatedSignal; + Vector3 mActiveLayoutTargetSize; + Vector3 mItemsParentOrigin; + Vector3 mItemsAnchorPoint; + Vector2 mTotalPanDisplacement; + ItemLayout* mActiveLayout; - bool mAnchoringEnabled; float mAnchoringDuration; - - float mRefreshIntervalLayoutPositions; ///< Refresh item view when the layout position changes by this interval in both positive and negative directions. - PropertyNotification mRefreshNotification; // stores the property notification used for item view refresh - bool mRefreshOrderHint; ///< True if scrolling towards the last item - - // Input handling - + float mRefreshIntervalLayoutPositions; ///< Refresh item view when the layout position changes by this interval in both positive and negative directions. float mMinimumSwipeSpeed; float mMinimumSwipeDistance; - float mWheelScrollDistanceStep; ///< The step of scroll distance in actor coordinates for each wheel event received. - + float mWheelScrollDistanceStep; ///< The step of scroll distance in actor coordinates for each wheel event received. float mScrollDistance; float mScrollSpeed; - Vector2 mTotalPanDisplacement; - float mScrollOvershoot; - bool mIsFlicking; - - Timer mWheelEventFinishedTimer; ///< The timer to determine whether there is no wheel event received for a certain period of time. - - Dali::Gesture::State mGestureState; - Actor mOvershootOverlay; ///< The overlay actor for overshoot effect - - bool mAddingItems; - - bool mRefreshEnabled; ///< Whether to refresh the cache automatically - - Vector3 mItemsParentOrigin; - Vector3 mItemsAnchorPoint; - - LayoutActivatedSignalType mLayoutActivatedSignal; + Dali::Gesture::State mGestureState : 3; + bool mAnimatingOvershootOn : 1; ///< Whether we are currently animating overshoot to 1.0f/-1.0f (on) or to 0.0f (off) + bool mAnimateOvershootOff : 1; ///< Whether we are currently animating overshoot to 1.0f/-1.0f (on) or to 0.0f (off) + bool mAnchoringEnabled : 1; + bool mRefreshOrderHint : 1; ///< True if scrolling towards the last item + bool mIsFlicking : 1; + bool mAddingItems : 1; + bool mRefreshEnabled : 1; ///< Whether to refresh the cache automatically + bool mInAnimation : 1; ///< Keeps track of whether an animation is controlling the overshoot property. }; } // namespace Internal diff --git a/dali-toolkit/public-api/dali-toolkit-version.cpp b/dali-toolkit/public-api/dali-toolkit-version.cpp index 795e9cf..b3b265f 100644 --- a/dali-toolkit/public-api/dali-toolkit-version.cpp +++ b/dali-toolkit/public-api/dali-toolkit-version.cpp @@ -31,7 +31,7 @@ namespace Toolkit const unsigned int TOOLKIT_MAJOR_VERSION = 1; const unsigned int TOOLKIT_MINOR_VERSION = 1; -const unsigned int TOOLKIT_MICRO_VERSION = 6; +const unsigned int TOOLKIT_MICRO_VERSION = 7; const char * const TOOLKIT_BUILD_DATE = __DATE__ " " __TIME__; #ifdef DEBUG_ENABLED diff --git a/packaging/dali-toolkit.spec b/packaging/dali-toolkit.spec index 9939f2c..8e5b5c9 100644 --- a/packaging/dali-toolkit.spec +++ b/packaging/dali-toolkit.spec @@ -1,6 +1,6 @@ Name: dali-toolkit Summary: The OpenGLES Canvas Core Library Toolkit -Version: 1.1.6 +Version: 1.1.7 Release: 1 Group: System/Libraries License: Apache-2.0, BSD-2.0, MIT